I am trying to migrate the Parse-server to a Debian Server and I am running into some trouble with the REST-API. When I try to call my application's login-function I receive the following error: Cannot POST /parse/login
.
These are the steps I have followed successfully before I received a server error.
main.js
. curl -H "X-Parse-Application-Id: <id1>" -H "Content-Type: application/json" -d '{}' 'serverName/parse/functions/login'
. Cannot POST /parse/login
error. I called it with curl -H "X-Parse-Application-Id: <id1>" -H "Content-Type: application/json" -d '{}' 'serverName/parse/login'
This is the migration guide I have followed This is the REST-API guide I have followed.
Can someone help me with this server error?
Correct. Login requires the GET
method not POST
!
By doing a simple GET
to that URL
, you should then be presented with the below error. Obviously you need to pass your params to make it successful.
{
"code": 200,
"error": "username is required."
}
Removing the -d '{}'
will revert that curl
to a GET
This answer is the best shot I can do with the information provided. The problem is most likely that the application is expecting a GET
request (or some other HTTP method other than POST
) but your curl request sends a POST
request.
To see what curl
is sending you can add -v
(I put in example.com
just to have a server which responds)
$ curl -v -H "X-Parse-Application-Id: <id1>" -H "Content-Type: application/json" -d '{}' 'example.com/serverName/parse/login'
* Trying 2606:2800:220:1:248:1893:25c8:1946...
* TCP_NODELAY set
* Connected to example.com (2606:2800:220:1:248:1893:25c8:1946) port 80 (#0)
> POST /serverName/parse/login HTTP/1.1
> Host: example.com
> User-Agent: curl/7.51.0
> Accept: */*
> X-Parse-Application-Id: <id1>
> Content-Type: application/json
> Content-Length: 2
The login function in the API guide expects a GET
request:
To do this, send a GET request to the /1/login endpoint with username and password as URL-encoded parameters:
I assume with the migration you also upgrade to a newer parse.com
app and the older version accepted POST
and the newer one not.
You'll need to change your curl request to use GET
instead of POST
. Just follow the example provided . Remove the -d
parameter and add the --data-urlencode
parameters
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.