Forum Discussion
AmitGogia
Jun 17, 2020Copper Contributor
File Upload in sharepoint Online
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.
Ashish_Kohale
Jun 17, 2020Iron Contributor
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):
2) Also check if your settings for the POSTMAN tool as per below:
setting ->general -> Requesttimeout in ms = 0
AmitGogia
Jun 18, 2020Copper Contributor
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_Testing/Shared 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.