Roblox API giving Invalid parameters response when they are correct

Hello,

I am trying to make an application (using python) that has a feature to display a Roblox user’s friends. I want to be able to use the alias that the user has set for their friends, though I cannot get the api to work.

I have tried to do this in Python, though it gives a 401 response of {"errors":[{"code":4,"message":"Invalid parameters.","userFacingMessage":"Something went wrong"}]}
The parameters seem to be as they are when the Roblox website sends a request.

This is my script:

import json

import requests

robloxSession = requests.Session()

robloxSession.cookies[".ROBLOSECURITY"] = "_|WARNING:-DO-NOT-SHARE-THIS.--Sharing-this-will-allow-someone-to-log-in-as-you-and-to-steal-your-ROBUX-and-items.|<--token-->"

req = robloxSession.post(url="https://auth.roblox.com/v2/logout")

robloxSession.headers["Content-Type"] = "application/json"

robloxSession.headers["Referer"] = "https://www.roblox.com"

robloxSession.headers["X-CSRF-TOKEN"] = req.headers["X-CSRF-Token"]

d = {"targetUserIds":[

# user ids of friends

]}

j = json.dumps(d)

req2 = robloxSession.post(url="https://contacts.roblox.com/v1/user/get-tags", json=j)

print(req2.content)

What’s wrong with this? Can somebody help please?
(also if this is the wrong category, i did not know which one to do sorry)

Have you tested your query on the docs page:
https://contacts.roblox.com/docs/index.html
I’d recommend ensuring your query works there

Yeah, i’ve tried it on there. It works there, but it does not work for me.

Not exactly sure why this is, but it works for me if I don’t json encode the payload.

Like this?

d = {"targetUserIds":[
    114942345
]}

req2 = robloxSession.post(url="https://contacts.roblox.com/v1/user/get-tags", data=d)

If so, it still doesn’t work for me

I still passed the data into the json parameter despite not encoding it, so like this:

d = {"targetUserIds":[
    114942345
]}

req2 = robloxSession.post(url="https://contacts.roblox.com/v1/user/get-tags", json=d)
1 Like

It worked! Thank you so much! <3

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.