简体   繁体   English

解析服务器AWS REST API错误

[英]Parse server aws REST API error

I created new parse server in amazon using bitnami image with parse dashboard, everything works fine but I am unable to connect parse REST api it throws error, 我使用解析仪表盘中的bitnami图像在亚马逊中创建了新的解析服务器,一切正常,但是我无法连接解析REST api,这会引发错误,

{"error":"unauthorized"}

I tried it with postman app 我用邮递员应用程序尝试过

in my header 在我的标题中

appId: ********************..
masterKey: *****************..

I send GET Request to this url 我将GET请求发送到此网址

http://ec2-**-***-***-***.us-west-2.compute.amazonaws.com/parse/api/1/classes/_User

but it doesn't works. 但它不起作用。

two problems: 两个问题:

  1. unless you have configured your parse server to include api/1 in the request uri, they don't belong there. 除非您已将解析服务器配置为在请求uri中包含api / 1,否则它们不属于该服务器。 The paths are a little different than parse.com. 路径与parse.com略有不同。

  2. you are using the wrong http headers. 您使用了错误的http标头。

Here's a curl that should work for you: 这是适合您的卷发:

curl https://your.server:port/parse/classes/_User -H "x-parse-application-id: XXX" -H "x-parse-master-key: XXX"

Note that the path is: parse/classes/_User 请注意,路径为: parse/classes/_User

And that the auth headers are: x-parse-application-id & x-parse-master-key 而auth标头是: x-parse-application-idx-parse-master-key

The good news is that the server response you are getting lets you know that parse-server is up and running and that's a big step ;) 好消息是,您收到的服务器响应使您知道parse-server已启动并正在运行,这是很大的一步;)

Hope that helps! 希望有帮助!

You can try it like this: 您可以这样尝试:

curl -X PUT \
-H "X-Parse-Application-Id: ${APPLICATION_ID}" \
-H "X-Parse-REST-API-Key: ${REST_API_KEY}" \
-H "Content-Type: application/json" \
-d '{"your_field":"your_data"}' \
https://api.parse.com/1/classes ##your url

Though New Parse Server do not require REST_API_KEY, using REST_API_KEY sometimes solve the problem. 尽管New Parse Server不需要REST_API_KEY,但是使用REST_API_KEY有时可以解决问题。 For Further reading please refer https://parseplatform.github.io/docs/rest/guide/#objects-creating-objects 如需进一步阅读,请参阅https://parseplatform.github.io/docs/rest/guide/#objects-creating-objects

I created new parse server in amazon using bitnami image with parse dashboard 我使用带有解析仪表板的bitnami图像在亚马逊中创建了新的解析服务器

I will suggest not to use bitnami image because when I was using this image a lot of features couldn't be used. 我建议不要使用bitnami图像,因为当我使用此图像时,许多功能无法使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM