Sitecore ItemService API - 405 Method not allowed
I was trying to create some items through Sitecore’s restful APIs and it kept returning: 405 - Method not allowed
.
I could get the API to respond and correctly create an item when I tested it with the JavaScript in the API documentation, but not with my code.
After a while I realised that I had copied the GET URL, which has a slightly different format.
GET | http://xp0.local/sitecore/api/ssc/item/?path=%2Fsitecore%2Fcontent%2FHomedatabase |
POST | http://xp0.local/sitecore/api/ssc/item/sitecore%2Fcontent%2Fhome |
As shown above, when creating an item via post, you don’t include the path as a querystring parameter, it’s in the URL path itself.
Hopefully this saves somebody else some time.