HTTP 500 error with sending an API request

I’m trying to send a request to an endpoint in my API. I have tried doing so in other services and it works fine, but doing so in roblox results in an HTTP 500 error.

Here’s the code:

local request=HTTPService:RequestAsync({
        Url="https://api.rac-corp.net/v2/roblox/iimf/group/shout",
        Method="PATCH",
        Headers={
            Authorization="not showing my key >:("
        },
        Body=HTTPService:JSONEncode({
            text="test"
        })
    })
print(request.Body)

Here’s what it returns:

{
  "status": 500,
  "code": 0,
  "detail": "Internal Server Error",
  "errors": [
    {
      "type": "internal",
      "filename": "/opt/render/project/python/Python-3.12.7/lib/python3.12/json/encoder.py",
      "line": 180,
      "error": "TypeError",
      "message": "Object of type bytes is not JSON serializable"
    }
  ],
  "messages": []
}

Because of this I am leading myself to think this is a bug, but to be honest I’m mediocre at programming… sooooo… any solutions?

1 Like

Try adding

["Content-Type"] = "application/json",

to your headers (as per the documentation)

2 Likes

Just tried, still the same response : (

Hey, if I’m not mistaken error codes in the 500s typically mean there’s an issue with the API backend itself, and not your request. You may want to look into the API code as it seems there’s an unhandled error on the server itself.

That wouldn’t make sense though… It works in other services as intended, it’s only on roblox where it doesn’t.

1 Like