File Upload in sharepoint Online

New Contributor

Hi All,

I need to upload a simple text file in SharepointOnline. While trying to import the file through Postman, I am getting the error as "Could not get response".

 

Request  help for the case.

6 Replies
I am not facing this issue, I would open a MS ticket to have it checked

Since I am new to sharepoint and might have done something wrong. Hence, I am writing the steps that are performed:

1. API that is build: Site/_api/web/GetFolderByServerRelativeUrl('/Folder name')/Files/add(url='abc.txt',overwrite=true)

2. Authorization, Content length and X-RequestDigest values are passed.

3. File is added in the body header.

 

Pls let me know in case something is wrong.

That is correct, is the folder already created?

Sorry, I have no idea why it is failing

@Ricardo Viana I have checked the postman Console and error is appearing as "read ECONNRESET". Do you have any idea regarding this?

@AmitGogia :

1) Hope you are not missing any of the steps below:

POST https://{site_url}/_api/web/GetFolderByServerRelativeUrl('/Folder Name')/Files/add(url='a.txt',overwrite=true)

Authorization: "Bearer " + accessToken

Content-Length: {length of request body as integer}

X-RequestDigest: "{form_digest_value}"

 

To get the access token please follow each steps as per given in below blog(written by me):

https://techcommunity.microsoft.com/t5/microsoft-365/setting-for-sharepoint-online-to-access-through...

 

2) Also check if your settings for the POSTMAN tool as per below:

setting ->general -> Requesttimeout in ms = 0 

@Ashish_Kohale 

 

Yes, I am following all the steps. Please look at it.

 

1. URL: https://abc.sharepoint.com/sites/site_Testing/_api/web/GetFolderByServerRelativeUrl('/sites/site_Tes... Documents/DEF')/Files/add(url='test2.txt',overwrite=true) 

 

2.  Below are the Header Parameters that are incorporated:

a. Accept --> application/json;odata=verbose

b. Authorization --> Bearer aasdcsfs

c. x-requestDigest --> iouhdushd8s89

 

Could you pls tell me the way to calculate content-length(I am not sure regarding this and have put 20).

 

Also, I had computed x-requestDigest value from http://abc.sharepoint.com/sites/site_Testing/_api/contextinfo

 

Requesttimeout in ms = 0 (This is done).

 

Pls let me know the mistake that I had performed so far.