I am setting up a local Parse Server using the instructions found here:
https://github.com/parse-community/parse-server#locally
It seems to be running but when I go to http://localhost:1337/parse
I get an authentication error. I also tried using python:
import json
from http import client
connection = client.HTTPConnection('localhost', 80)
connection.connect()
connection.request('POST', '/parse/sites/cheese', json.dumps({
"url": "http://www.cheese.com",
"name": "I love cheese!"
}), {
"X-Parse-Application-Id": "myappid",
"X-Parse-REST-API-Key": "",
"Content-Type": "application/json"
})
results = json.loads(connection.getresponse().read())
print (results)
However, I get:
TypeError: the JSON object must be str, not 'bytes'
I assume the response is an error object or something.
In any case, there doesn't seem to be a way to configure anything and the getting started docs doesn't explicitly indicate how to add an "X-Parse-REST-API-Key".
If I look in the directory where installed parse there is just a logs
directory. Nothing else. I would expect that there would be a configuration file or something. Any pointers on how I can get a parse server running?
For saving an object using Python to Parse Server, write a code like this:
import json,httplib
connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
connection.connect()
connection.request('POST', '/parse/classes/GameScore', json.dumps({
"score": 1337,
"playerName": "Sean Plott",
"cheatMode": False
}), {
"X-Parse-Application-Id": "${APPLICATION_ID}",
"X-Parse-REST-API-Key": "${REST_API_KEY}",
"Content-Type": "application/json"
})
results = json.loads(connection.getresponse().read())
print results
You can check in this link here: https://docs.parseplatform.org/rest/guide/#creating-objects
Note that there is a Python option in the sample code.