Skip to main content
Solved

Creating Virtualization Client thru API


Getting 400 Bad Reques “Request body is empty or format is invalid”

Its for the Virtualization client and I’m just trying to create a new client.  Should be pretty simple.

POST {{ServerUrl}}/Client

This is in the example call for POSTMAN and not working.  Anyone know what is wrong?

{

    "clientInfo": {

        "clientType": 12,

        "virtualServerClientProperties": {

            "virtualServerInstanceInfo": {

                "vsInstanceType": {{vsInstanceType}},

                "associatedClients": {

                    "memberServers": o

                        {

                            "client": {

                                "clientName": "{{clientName}}"

                            }

                        }

                    ]

                },

                "vmwareVendor": {

                    "vcenterHostName": "{{vcenterHostName}}",

                    "virtualCenter": {

                        "password": "{{base64encodedPassword}}",

                        "userName": "{{UserName}}"

                    }

                }

            }

        }

    },

    "entity": {

        "clientName": "{{clientName}}"

    }

}

4 replies

Badge +1

Hello,

What hypervisor is this for?

Badge +4

VMWARE.

Userlevel 3
Badge +6

400 “Request body is empty or format is invalid” is a pretty generic error. Have you double checked the basics… 

  • Is the Content-type header set to application/json?
  • Is your body payload valid json?
  • Do the values returned by your variables need escaping? (try removing them / sending empty values for them and see if you get a different error back)
Badge +4

After coming back to this after two weeks I was able to get it working.  Removing the variables and sending empty values started giving me actual errors I could use to get it going.  I just kept getting bad request so was starting to think there was something wrong with the JSON format but it was just one of the values was causing this erorr, thanks for th help.

Reply