External API Issue: Upload plain text file to SharePiont via Graph API errors with content-type issue

I am trying to upload text.txt to SharePoint using Graph API here: https://learn.microsoft.com/en-us/graph/api/driveitem-put-content?view=graph-rest-1.0&tabs=http

My request works perfectly in Postman, where my content is in body/raw text. I think I am passing my content wrong somehow in Xano. Not sure how to pass the body content.

In Xano the following request returns error: "Entity only allows writes with a JSON Content-Type header."

- But it works in Postman so my permissions are all correct and the content-type is correct.

This is my request:

request: {

url:

https://graph.microsoft.com/v1.0/sites/{{site_id}}/drives/{{drive_id}}/root/:Test/testing.txt:/content,

method: PUT,

headers: [

PUT /v1.0/sites//{{site_id}}/drives/{{drive_id}}/root/:Test/testing.txt:/content HTTP/2,

Host: graph.microsoft.com,

Accept-Encoding: gzip, deflate,

Content-Type: text/plain,

Authorization: Bearer <token>,

Accept: application/json,

Content-Length: 30

],

params:

This is sample text content for the document

here's how I setup in Xano, where my content is a string text:

1
5 replies