Forum Discussion
403 Forbidden on Rest-API when trying to use Post or Patch
Hello everyone,
I'm trying to use the REST-API of Sharepoint (On-Premise). When I use Get-Requests everything is just fine. As soon as I try to change data using either a Patch or Post Request I get an error (403 Forbidden). We are using the NTLM-Authentication and I'm requesting a X-RequestDigest freshly before doing any Post or Patch requests. The IT-department, which is managing Sharepoint is reporting that it has given me every possible permission. On the web interface I'm also able to change any data I'm trying to change by API. I have added the response from sharepoint down below. I'm at my wits' end. What could I be missing?
5 Replies
- TraKieuCopper ContributorHi Mbeenen,
I got a problem when uploading a file to attachment files. For example (http:mysharepoint/sites/mysite/items(1)/AttachmentFiles(FileName='F:/testfile.pdf'). And they cannot understand the ":". I used to work with SP online and there is no problem but with on premise, I don't know how to deal with it. There may be a solution in modifying web.config but I still cannot find it in the server.
If you used to have the same problem, feel free to share with me.
Thank you and have a nice day,
Tra- mbeenenCopper ContributorHi Tra,
i have not used that endpoint, but other endpoints dealing with files. As far as I understand it, it only expects a filename there, not a path. You propably tried to use your local path to the file. The server has no way to access that file from your local system.
The filename you enter there will be the name for the new file on sharepoint. The content the file is supposed to have has to be sent as a body in the rest call.
- TraKieuCopper Contributor
Hi,
I got the same problem like you. I wonder if you have any solution to this.
Thank you and have a nice day,
Tra
- mbeenenCopper ContributorHi Tra,
my problem was, that each request was made with a new connection. You have to keep open the connection you used for getting the XRequestDigest and you need to request a new Digest, if that connection ever closes unexpectedly.
Have a nice day,
Max