Skip to main content
Answer

Creating Virtualization Client thru API

  • June 22, 2023
  • 4 replies
  • 121 views

Forum|alt.badge.img+4

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": [

                        {

                            "client": {

                                "clientName": "{{clientName}}"

                            }

                        }

                    ]

                },

                "vmwareVendor": {

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

                    "virtualCenter": {

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

                        "userName": "{{UserName}}"

                    }

                }

            }

        }

    },

    "entity": {

        "clientName": "{{clientName}}"

    }

}

Best answer by RMcG

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)

4 replies

Forum|alt.badge.img+1

Hello,

What hypervisor is this for?


Forum|alt.badge.img+4
  • Author
  • Byte
  • June 23, 2023

VMWARE.


Forum|alt.badge.img+6
  • Vaulter
  • Answer
  • June 26, 2023

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)

Forum|alt.badge.img+4
  • Author
  • Byte
  • July 17, 2023

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.