The basic REST login example is NOT working.
I followed “Example” paragraph, here:
http://backendless.com/documentation/users/rest/users_overview.htm
and I called REST api to try user login. This simple http call is NOT working:
curl
-H application-id:application-id
-H secret-key:secret-key
-H application-type:REST
-H Content-Type:application/json
-X POST
-d ‘{“name”:“James Bond”, “password”:“watchingya”, “email”:"jbond@007.com"}’
-v https://api.backendless.com/v1/users/register
call returns:
{“message”:“Could not parse request with message: Invalid Json”,“code”:8002}* Connection #1 to host api.backendless.com left intact
(ofcourse I used my app-id and secret code, and I have user defined)
Do you know what is wrong ?
Hi Haim,
What operating system do you use? I just tried this request on a mac os x and it worked just fine. If you’re on Windows, I suspect you might need to escape the double quotes in the request so it would look like this:
curl -H application-id:YOUR-APP-ID -H secret-key:YOUR-SECRET-KEY -H application-type:REST -H Content-Type:application/json -X POST -d "{\"name\":\"Foo\", \"email\":\"foo@backendless.com\", \"password\":\"test\"}" -v http://api.backendless.com/v1/users/register
Notice the body of the request in this case is in double quotes and every single value in the body has the double quotes escaped with the backslash.
Btw, the request you tried is a registration call, not the login.
Regards,
Mark
Yes, I have used windows shell, and that solved my problem.
Thanks Mark