Error 405 Method not Allowed in a random Patch call
Hello, We're now using lots of REST calls, mainly Get calls, and some are Patches. They've always been working well, never had any problems with making or calling any of them. But recently I made another and it's now always returning a 405 Method not Allowed error even though the configuration is exactly the same as with the others; without any headers, no return value and a plain HTTP authentication. I'm just sending over a JSON body, just like the other Patch calls and the URL contains out of the normal rest URl with one added operation path simply called “save” which isn't a restricted word, cause I've even tried changing that :) It also keeps sending “Allow: GET” in the response header, which makes no sense cause it's no possible to send a body with a Rest GET. If anyone could be able to shed some light on to why the 405 error could start appearing all of a sudden, I would very much appreciate it. Thanks in advance!
This documentation page may help you find the issue. Furthermore, you can set the REST publish node to trace, to see why Mendix is choosing the operation.
Rom van Arendonk
Alright, seems like I solved it. Some wizard must have put a spell on my rest calls, cause I have 2 more Patch calls (operations) in the same resource with URL's: “URL/resource/path1” and “URL/resource/path/param1/param2” and I used to use “URL/resource/path2” for my non-functioning Patch call. I then tried “URL/resource/path2/param1” and “URL/resource/path2/path3” which also didn't work. I now have “URL/resource/path2/path3/path4” which does seem to work for some reason.
In short: Apparently my URL just needed a few more operation paths in it's URL to make it work and not suggest me using a GET call anymore. I've got no idea why or how, so if anyone has a better understanding of why this happend, please let me know, I'm very curious.