0

I am using below endpoint to get the content of file in sharepoint:

https://<site>/_api/web/GetFolderByServerRelativeUrl('folder name')/Files('file name')/$value?binaryStringResponseBody=true

But this is returning a response in octet stream and the content type of response is application/octet-stream. Is there a way to get the content in human readable format directly? If not , is there a way to convert it into other format in java?

0

We need to use the below API:

GET https://mysite.sharepoint.com/<site_name>/_api/web/lists(guid'<list-id>')/items(<item-id>)/File

api of sharepoint using list id and item id obtained from /getchanges api. Then use the ServerRelativeUrl field of response to obtain file contents by calling :-

GET http://mysite.sharepoint.com/<site_name>/_api/web/getfilebyserverrelativeurl('<url>)/$value?binaryStringResponseBody=true

Reference URL:

How to point to/get the file contents or file from SharePoint changes api call

how to get file content from sharepoint list using restapi in java

Similar question discussed here:

https://stackoverflow.com/questions/48422868/how-to-get-file-content-from-sharepoint-list-using-restapi-in-java

  • Thanks for answering this. But as i mentioned in the question getFileByServerRelativeUrl api is returning the response in octet-stream. Iam looking for an api to get response as plain text. – Ayushi Goel Dec 20 '19 at 6:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.