I am using the Sharepoint Online REST API.
I can successfully make the following request:
GET /_api/web/GetFileByServerRelativeUrl('/Shared%20Documents/Hello.docx') HTTP/1.1
Host: SITE.sharepoint.com
Authorization: Bearer TOKEN
Accept: application/atom+xml
Cache-Control: no-cache
However, when I try to make the below request
POST /_api/web/GetFolderByServerRelativeUrl('/Shared Documents')/files/add(overwrite=true,url='test.txt') HTTP/1.1
Host: SITE.sharepoint.com
Authorization: Bearer TOKEN
Accept: application/atom+xml
Cache-Control: no-cache
"hello, world"
I get the response
<?xml version="1.0" encoding="utf-8"?>
<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code>-2147024891, System.UnauthorizedAccessException</m:code>
<m:message xml:lang="en-US">Access denied. You do not have permission to perform this action or access this resource.</m:message>
</m:error>
I am requesting the following scopes:
Web.FullControl Site.FullControl AllSites.FullControl List.FullControl
Am I missing a scope for this request, or is there some other permissions I need to set elsewhere?