I'm trying to insert new record into parse platform table with objectId (complaint one).
However when I do POST call:
curl -X POST \
-H "X-Parse-Application-Id: ${APPLICATION_ID}" \
-H "X-Parse-Master-Key: ${MASTER_KEY}" \
-H "Content-Type: application/json" \
-d '{"objectId": "xdH402yd9z", "field": "testData"}' $URL
the post fails with: {"code":105,"error":"objectId is an invalid field name."}
How can I insert the record with existing objectId?
Note: the data I'm inserting is basically the same one I got out of parse server prior but with few minor changes.
Thank you.
Using a custom objectId
is disabled by default. You will need to enable customObjectId
on the server. Depending on how you start your server you can try something like below in your app.js:
const api = new ParseServer({
databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
cloud: process.env.PARSE_SERVER_CLOUD || __dirname + '/cloud/main.js',
appId: process.env.PARSE_SERVER_APPLICATION_ID || 'myAppId',
masterKey: process.env.PARSE_SERVER_MASTER_KEY || '',
//readOnlyMasterKey: process.env.PARSE_SERVER_READ_ONLY_MASTER_KEY,
encryptionKey: process.env.PARSE_SERVER_ENCRYPTION_KEY,
objectIdSize: parseInt(process.env.PARSE_SERVER_OBJECT_ID_SIZE) || 10,
serverURL: process.env.PARSE_SERVER_URL || 'http://localhost:' +process.env.PORT + '/parse',
publicServerURL: process.env.PARSE_PUBLIC_SERVER_URL || 'http://localhost:' +process.env.PORT + '/parse',
allowCustomObjectId: true, // Here's what you need to enable
You can see a complete example here: https://github.com/netreconlab/parse-hipaa/blob/parse-swift/parse/index.js
You can also set the environment variable:
PARSE_SERVER_ALLOW_CUSTOM_OBJECT_ID = 1