File Upload in sharepoint Online

%3CLINGO-SUB%20id%3D%22lingo-sub-1469968%22%20slang%3D%22en-US%22%3EFile%20Upload%20in%20sharepoint%20Online%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1469968%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20All%2C%3C%2FP%3E%3CP%3EI%20need%20to%20upload%20a%20simple%20text%20file%20in%20SharepointOnline.%20While%20trying%20to%20import%20the%20file%2C%20I%20am%20getting%20the%20error%20as%20%22Could%20not%20get%20response%22.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERequest%26nbsp%3B%20help%20for%20the%20case.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1469968%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFile%20Upload%20in%20Sharepoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1470001%22%20slang%3D%22en-US%22%3ERe%3A%20File%20Upload%20in%20sharepoint%20Online%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1470001%22%20slang%3D%22en-US%22%3EI%20am%20not%20facing%20this%20issue%2C%20I%20would%20open%20a%20MS%20ticket%20to%20have%20it%20checked%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1470045%22%20slang%3D%22en-US%22%3ERe%3A%20File%20Upload%20in%20sharepoint%20Online%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1470045%22%20slang%3D%22en-US%22%3E%3CP%3ESince%20I%20am%20new%20to%20sharepoint%20and%20might%20have%20done%20something%20wrong.%20Hence%2C%26nbsp%3BI%20am%20writing%20the%20steps%20that%20are%20performed%3A%3C%2FP%3E%3CP%3E1.%20API%20that%20is%20build%3A%26nbsp%3BSite%2F_api%2Fweb%2FGetFolderByServerRelativeUrl('%2FFolder%20name')%2FFiles%2Fadd(url%3D'abc.txt'%2Coverwrite%3Dtrue)%3C%2FP%3E%3CP%3E2.%20Authorization%2C%20Content%20length%20and%20X-RequestDigest%20values%20are%20passed.%3C%2FP%3E%3CP%3E3.%20File%20is%20added%20in%20the%20body%20header.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPls%20let%20me%20know%20in%20case%20something%20is%20wrong.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1470079%22%20slang%3D%22en-US%22%3ERe%3A%20File%20Upload%20in%20sharepoint%20Online%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1470079%22%20slang%3D%22en-US%22%3EThat%20is%20correct%2C%20is%20the%20folder%20already%20created%3F%3CBR%20%2F%3E%3CBR%20%2F%3ESorry%2C%20I%20have%20no%20idea%20why%20it%20is%20failing%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1470219%22%20slang%3D%22en-US%22%3ERe%3A%20File%20Upload%20in%20sharepoint%20Online%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1470219%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F119994%22%20target%3D%22_blank%22%3E%40Ricardo%20Viana%3C%2FA%3E%26nbsp%3BI%20have%20checked%20the%20postman%20Console%20and%20error%20is%20appearing%20as%20%22%3CSPAN%3Eread%20ECONNRESET%3C%2FSPAN%3E%22.%20Do%20you%20have%20any%20idea%20regarding%20this%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1471618%22%20slang%3D%22en-US%22%3ERe%3A%20File%20Upload%20in%20sharepoint%20Online%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1471618%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F701870%22%20target%3D%22_blank%22%3E%40AmitGogia%3C%2FA%3E%26nbsp%3B%3A%3C%2FP%3E%3CP%3E1)%20Hope%20you%20are%20not%20missing%20any%20of%20the%20steps%20below%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22hljs-attribute%22%3E%3CSTRONG%3EPOST%3C%2FSTRONG%3E%20https%3A%2F%2F%7Bsite_url%7D%2F_api%2Fweb%2FGetFolderByServerRelativeUrl('%2FFolder%20Name')%2FFiles%2Fadd(url%3D'a.txt'%2Coverwrite%3Dtrue)%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CSPAN%20class%3D%22hljs-attribute%22%3EAuthorization%3C%2FSPAN%3E%3C%2FSTRONG%3E%3CSPAN%3E%3CSTRONG%3E%3A%3C%2FSTRONG%3E%20%22Bearer%20%22%20%2B%20accessToken%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CSPAN%20class%3D%22hljs-attribute%22%3EContent-Length%3C%2FSPAN%3E%3C%2FSTRONG%3E%3CSPAN%3E%3CSTRONG%3E%3A%3C%2FSTRONG%3E%20%7Blength%20of%20request%20body%20as%20integer%7D%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CSPAN%20class%3D%22hljs-attribute%22%3EX-RequestDigest%3C%2FSPAN%3E%3C%2FSTRONG%3E%3CSPAN%3E%3CSTRONG%3E%3A%3C%2FSTRONG%3E%20%22%7Bform_digest_value%7D%22%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSTRONG%3ETo%20get%20the%20access%20token%20please%20follow%20each%20steps%20as%20per%20given%20in%20below%20blog(written%20by%20me)%3A%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fmicrosoft-365%2Fsetting-for-sharepoint-online-to-access-through-external-network%2Fm-p%2F1423477%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fmicrosoft-365%2Fsetting-for-sharepoint-online-to-access-through-external-network%2Fm-p%2F1423477%3C%2FA%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E2)%20Also%20check%20if%20your%20settings%20for%20the%20POSTMAN%20tool%20as%20per%20below%3A%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Esetting%20-%26gt%3Bgeneral%20-%26gt%3B%20Requesttimeout%20in%20ms%20%3D%200%3C%2FSPAN%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1473011%22%20slang%3D%22en-US%22%3ERe%3A%20File%20Upload%20in%20sharepoint%20Online%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1473011%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F679665%22%20target%3D%22_blank%22%3E%40Ashish_Kohale%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYes%2C%20I%20am%20following%20all%20the%20steps.%20Please%20look%20at%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E1.%20URL%3A%26nbsp%3B%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fabc.sharepoint.com%2Fsites%2Fsite_Testing%2F_api%2Fweb%2FGetFolderByServerRelativeUrl('%2Fsites%2Fsite_Testing%2FShared%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fabc.sharepoint.com%2Fsites%2Fsite_Testing%2F_api%2Fweb%2FGetFolderByServerRelativeUrl('%2Fsites%2Fsite_Testing%2FShared%3C%2FA%3E%20Documents%2FDEF')%2FFiles%2Fadd(url%3D'test2.txt'%2Coverwrite%3Dtrue)%3C%2FSPAN%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E2.%26nbsp%3B%20Below%20are%20the%20Header%20Parameters%20that%20are%20incorporated%3A%3C%2FP%3E%3CP%3Ea.%20Accept%20--%26gt%3B%26nbsp%3Bapplication%2Fjson%3Bodata%3Dverbose%3C%2FP%3E%3CP%3Eb.%26nbsp%3BAuthorization%20--%26gt%3B%26nbsp%3BBearer%20aasdcsfs%3C%2FP%3E%3CP%3Ec.%26nbsp%3Bx-requestDigest%20--%26gt%3B%26nbsp%3Biouhdushd8s89%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECould%20you%20pls%20tell%20me%20the%20way%20to%20calculate%20content-length(I%20am%20not%20sure%20regarding%20this%20and%20have%20put%2020).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlso%2C%20I%20had%20computed%26nbsp%3Bx-requestDigest%20value%20from%26nbsp%3B%3CA%20href%3D%22http%3A%2F%2Fabc.sharepoint.com%2Fsites%2Fsite_Testing%2F_api%2Fcontextinfo%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fabc.sharepoint.com%2Fsites%2Fsite_Testing%2F_api%2Fcontextinfo%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3ERequesttimeout%20in%20ms%20%3D%200%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B(This%20is%20done).%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPls%20let%20me%20know%20the%20mistake%20that%20I%20had%20performed%20so%20far.%3C%2FP%3E%3C%2FLINGO-BODY%3E
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.