Hello
I’m new to the Roblox API however, i can’t get past that one following error.
Code sample:
headers = {'x-api-key' : API_KEY, 'Content-Type': 'application/octet-stream'}
params={"datastoreName" : "AmountDonatedStore", "entryKey" : str(user.id)+"-xp"}
r = requests.post("https://apis.roblox.com/datastores/v1/universes/3450454946/standard-datastores/datastore/entries/entry", headers=headers, params=params)
The error i get is this one:
b'{"error":"INVALID_ARGUMENT","message":"Content-md5 header required.","errorDetails":[{"errorDetailType":"DatastoreErrorInfo","datastoreErrorCode":"ContentMd5Required"}]}'
thanks in advance
1 Like
I’ve come further a few steps:
I have to send a “Content-md5” argument in the headers dictionary:
headers = {'x-api-key' : API_KEY, 'Content-Type': 'application/octet-stream', "Content-md5": "md5-hash"}
However, i’ve not found a proper way of encoding the hash
Whincify
(Whincify)
#3
Is there a reason you are posting to the API instead of just using DataStoreService?
yeah, i’m trying to access it externally, however, the issue has been solven trough the help of roblox staff.
1 Like
in case you want it:
Here is a code sample of how to retrieve an entry from a Datastore:
def getEntry(API_KEY, UniverseID:str, datastoreName:str, entryKey:str):
headers = {'x-api-key' : API_KEY, 'Content-Type': 'application/json'}
params={"datastoreName" : datastoreName, "entryKey" : entryKey}
encoded = str.encode(json.dumps(params))
checksum = hashlib.md5(encoded).digest()
checksum = base64.b64encode(checksum)
headers["Content-md5"] = checksum
url = "https://apis.roblox.com/datastores/v1/universes/" + UniverseID + "/standard-datastores/datastore/entries/entry"
r = requests.post(url, headers=headers, params=params, data=encoded)
return r
1 Like