Help with universe configuration api

So I have been experimenting with the develop api, and have been trying to use the universe configuration api (Develop Api). I have tried using it both in my code and in the api page itself, however I keep getting the same error on both, the following is my code:

universeId = 'id of my universe is here'
session.patch(''.join(['https://develop.roblox.com/v2/universes/',universeId,'/configuration']),

        json = {

            "allowPrivateServers": True,

            "privateServerPrice": 0,

            "name": "test",

            "description": "test",

            "universeAvatarType": "MorphToR6",

            "universeAnimationType": "Standard",

            "universeCollisionType": "InnerBox",

            "universeJointPositioningType": "Standard",

            "isArchived": False,

            "isFriendsOnly": False,

            "genre": "All",

            "playableDevices": [

                "Computer",

                'Phone',

                'Tablet',

                'Console'

            ],

            "isForSale": False,

            "price": 0,

            "universeAvatarAssetOverrides": [

                {

                "assetID": 0,

                "assetTypeID": 0,

                "isPlayerChoice": True

                }

            ],

            "universeAvatarMinScales": {

                "height": 0,

                "width": 0,

                "head": 0,

                "depth": 0,

                "proportion": 0,

                "bodyType": 0

            },

            "universeAvatarMaxScales": {

                "height": 0,

                "width": 0,

                "head": 0,

                "depth": 0,

                "proportion": 0,

                "bodyType": 0

            },

            "studioAccessToApisAllowed": True,

            "permissions": {

                "IsThirdPartyTeleportAllowed": False,

                "IsThirdPartyAssetAllowed": False,

                "IsThirdPartyPurchaseAllowed": False

            },

            "optInRegions": [

                "Unknown"

            ],

            "optOutRegions": [

                "Unknown"

            ]

        })

The error I get in both the api page and in my code is the following:

{
  "errors": [
    {
      "code": 0,
      "message": "InternalServerError"
    }
  ]
}

Any help would be appreciated :smile:

1 Like

I tried it out and I was getting the same error, however I made three changes, (two of which I found by passing the table through a JSON linter) and it’s now returning status code 200:

1-

I believe this, as well as the other arguments in this array should have double quotes

2- Booleans should be true or false, all lowercase, your first letters are uppercase.

3- Switch the content type to application/x-www-form-urlencoded

1 Like

im using python requests library, in python booleans are supposed to start with upper case, I dont think the double quote matters but I will change that, il research more about that 3rd suggestion tho.

1 Like

Ohh my bad, thought it was in JS. Single/double quotes shouldn’t matter then. Switching the content to form-urlencoded should hopefully fix it tho. I don’t know why the other two types are available on the API page if they don’t work, might be a bug. :man_shrugging:

I’m not savvy enough in JSON/JS to make a bug report, I only really know how to make basic requests. If you want to make one and don’t have regular trust level, you can send a message to @Bug-Support

2 Likes

I haven’t worked with this at all but I think @7z99 raises a good point… Shouldn’t all this JSON be a multiline string, not a dictionary… Try with triple " quotes around it… And you probably have to change those caps on the booleans back again etc. Sorry if I’m wrong about this. :slight_smile:

edit: (Or just import json and then use json.dumps())

1 Like

I have tried your 3rd suggestion and have gotten an interesting result, not the one I expected, but definitely a step in the right direction.

by including in the headers of the request the following:

headers = {'Content-Type': 'application/x-www-form-urlencoded'}

instead of getting an internal server error, It returns the current configurations of the universe I am trying to change, however the universe configurations still aren’t being update to what I am sending.

when you put a dictionary as json in a request, it automatically turns the dictionary into json when making the requests, Idk what you are trying to say with the triple quotes. Also about the caps in the booleans, I have already answered that question in @7z99’s comment

That’s really odd. I looked back at the API and it seems to be doing that to me too. I tried changing a random game’s name to “test” and it just returned a table of non-updated information. Not sure how to help apart from that, seems like some progress is being made tho. I really think it’s a bug, I’d report it. In the meantime, there’s a similar endpoint under v1 if you want to give that a shot?

image
https://develop.roblox.com/docs#!/UniverseSettings/patch_v1_universes_universeId_configuration

2 Likes

Oh I see, yeah you are right. Neat feature, sorry! Triple quotes create a multiline string, but its probably not good to write JSON that way manually yes. :slight_smile:

1 Like

il look into it, ty for the help :smile:

1 Like

I looked into the error codes. Usually if the code is 0, it has to do with the authentication. Otherwise, it might be an unlisted error code that is not displayed on the documents. If so, apologies.

It’s not that I think, because I have both my roblosecurity and xcsrf token in my headers, and ye, I also found it interesting that the error isn’t documented tbh

1 Like

After asking the question in the Roblox API discord server, I finally got the solution. You don’t need to include all configurations fields in your JSON, here is a more detailed answer from the person who gave it:

Thank you for everyone who helped with the solution :smile: