Search code examples
sharepointpostmansharepoint-2013sharepoint-onlinesharepoint-rest-api

Upload file to SharePoint through rest API Postman


Using Postman

Url:https://test.sharepoint.com/sites/testIntranet/_api/web/GetFolderByServerRelativeurl('testIntranet/BMT')/Files/add(url='114934-image.png',overwrite=true)

error: Access denied

when using this url without /web : https://test.sharepoint.com/sites/testIntranet/_api/GetFolderByServerRelativeurl('testIntranet/BMT')/Files/add(url='114934-image.png',overwrite=true)

error:Cannot find resource for the request GetFolderByServerRelativeurl

Note: Access token is correct with full permissions.

Can anyone please let me know what is correct and what is wrong!

if the first URL is correct then how to get access permissions ? if the second URL is correct then how to add resources correctly ?


Solution

  • The url should be like following

    _api/Web/GetFolderByServerRelativeUrl('/sites/abc/FolderTest/Test')/Files/add(url='filename.png',overwrite=true)')
    

    You can upload file in body like following pic enter image description here