Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Roboko Posted July 28, 2019 Posted July 28, 2019 Hello, I've been trying to use the REST api to create a new user on my test forum. My request is like the following (I changed some details to protect my website):- URL https://testforum.example.com/api/core/members?key=######################## ###### Being API Key Body {"email":"example@example.com","group":3,"name":"username","password":"Spaghetti20!"} Headers is just containing Content-type application/json When I send a request in this format, I get back { "errorCode": "1C292\/8", "errorMessage": "NO_USERNAME_OR_EMAIL" } As you can see from request body, I do send both username and email field as per the documentation So why do I get this error..? Also, another strange thing is that, whilst I get a response from my server, it is not logged. REST api logs shows up as empty, no failures..? Any help would be greatly appreciated.
Roboko Posted July 28, 2019 Author Posted July 28, 2019 Fixed it myself, posting solution in case it helps others Turns out that invision REST API does not accept json. You must encode with application/x-www-form-urlencoded . Would have been nicer if the server gave an appropriate error response for this. it took me by surprise that JSON isn't accepted.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.