Reputation: 826
I am testing a file upload to SharePoint online with Postman. In my post request I set the body to form-data and add a file param with a text file called a.txt. The text file contains the text
one
two
three
When I execute the request my file is uploaded but when I open the file the contents is
----------------------------235004993628819232914336
Content-Disposition: form-data; name="file"; filename="a.txt"
Content-Type: text/plain
one
two
three
----------------------------235004
I have tried setting the Content-Type header to
application/x-www-form-urlencoded or multipart/form-data
But no luck
Upvotes: 5
Views: 32142
Reputation: 826
In my case setting the body to type binary solved my problem with testing with Postman
Upvotes: 3
Reputation: 723
Please follow the below steps-
1. Go to the body of the API
2. pass the parameter or key
3. When you pass the key you have a option of value of Text/File like below
4.Choose the file from
5. Click on send.
6. Get your response.
Hope this helps buddy.
Upvotes: 17