I trying to upload a simpale text as file to oneDrive using REST API.
I Create App inportal.azure.com
And i add the follow API permissions
I create a token: https://login.microsoftonline.com/< My tenantName>/oauth2/v2.0/token Send the follow pramters:
- grant_type client_credentials
- client_id My client id
- client_secret My client secret
- scope https://graph.microsoft.com/.default
Content-Type application/x-www-form-urlencoded Keep-Alive true
I send it as a post and get a JSON with the token.
Then I try to upload the text as file.
using the follow URL https://graph.microsoft.com/v1.0/drive/root://test.txt:/content
authorization Bearer {my token String}
Content-Type text/plain
Body "The string that needs to upload"
{ "error": { "code": "BadRequest", "message": "Unable to retrieve tenant service info.", "innerError": { "request-id": "098f37d5-96fd-44d0-905b-c147eac223f5", "date": "2020-05-19T11:43:03" } } }
What I do Wrong?
Thanks in advance