I am having a bit of trouble with the SetAsync equivalent in the Open Cloud Datastore API.
Here is my example NodeJS code:
const crypto = require('crypto');
const fetch = require('node-fetch');
const jsonData = JSON.stringify({
num: 1000
});
// The blanks are just placeholders, I have verified that they actually exist
fetch('https://apis.roblox.com/datastores/v1/IDHERE/standard-datastores/datastore/entries/entry?datastoreName=NAMEHERE&entryKey=KEYNAMEHERE', {
method: 'POST',
headers: {
'x-api-key': 'XXXXXXXXXX--API-KEY-HERE--XXXXXXXXXX',
'content-md5': crypto.createHash('md5').update(jsonData).digest('base64'),
'content-type': 'application/json',
'roblox-entry-userids': '[]',
'roblox-entry-attributes': '{}'
},
body: jsonData
});
My error is:
{"error":"INVALID_ARGUMENT","message":"Md5 checksum mismatch.","errorDetails":[{"errorDetailType":"DatastoreErrorInfo","datastoreErrorCode":"ChecksumMismatch"}]}
I actually get this error when using cURL and filling in the values generated in Node, the Node error is just 400 Bad Request
How else would I go about generating the checksum for numbers, strings, and complex datatypes like arrays and dictionaries?