I've been combing through Microsoft's documentation on the REST API to manipulate files in our SharePoint Online document tree. I'm ALMOST to my solution but having an issue.
I'm running CURL commands on a Linux server. And in the /tmp directory on Linux I have a file 'a.txt'. I can create a new file on SharePoint online using CURL, but I cannot upload an existing file using the same command.
When I specify "Content-Length: 0", this command successfully creates a new file on our SharePoint
curl -X POST -i -H "Authorization: Bearer tokenabc" -H "Content-Length: 0" -s "https://tenant.sharepoint.com/teams/testSite/_api/web/GetFolderByServerRelativeUrl('%20Shared%20Documents')/Files/add(url='a.txt',overwrite=true)"
But when I try to actually UPLOAD my file from the /tmp directory, (I run the CURL command in the /tmp directory, I change "Content-Length: 4000"), I get no response whatsoever and no file is created.
curl -X POST -i -H "Authorization: Bearer tokenabc" -H "Content-Length: 4000" -s "https://tenant.sharepoint.com/teams/testSite/_api/web/GetFolderByServerRelativeUrl('%20Shared%20Documents')/Files/add(url='a.txt',overwrite=true)"
I cannot seem to figure out how to upload my file from the Linux server itself using this CURL REST API command