VMware Cloud Community
Dell_Technologi
Enthusiast
Enthusiast

Import Unmanaged VM via REST API

Hi,

Lately we had the need to import unmanaged vm's to vRA BG's.

We were able to do so with CloudClient but we want to automate this process.

vRA supporting REST API calls so we found a method for registering unmanaged VM's to vRA :

https://vRA-FQDN/iaas-proxy-provider/api/machines/register

This is the body of the POST:

{

  "owner": "string",

  "virtualMachineId": "string",

  "requestingUser": "string",

  "componentId": "string",

  "machineProperties": [

    {

      "virtualMachineId": "string",

      "isEncrypted": false,

      "name": "string",

      "id": "string",

      "value": "string",

      "isRuntime": false,

      "isHidden": false

    }

  ],

  "compositeBlueprintId": "string",

  "deploymentName": "string",

  "hostReservationId": "string",

  "templateId": "string",

  "hostStorageReservationId": "string"

}

We filled those properties as needed but the error we are getting back is:

"Data serialization error.

Could not read message [acceptableTypes: [application/*+json, application/json]]"

Can someone help with this error ?

Thanks.

Reply
0 Kudos
5 Replies
eoinbyrne
Expert
Expert

Looks like you need to set the Content-type header on the request?

e.g.

restRequest.setHeader("Content-type", "application/json");

or

restRequest.contentType = "application/json";

Reply
0 Kudos
Dell_Technologi
Enthusiast
Enthusiast

We are using Postman right now for my REST API calls.

the header looks like this:

Content-Type : application/json

Accept : application/json

everything looks fine, but the issue is very unclear...

Reply
0 Kudos
eoinbyrne
Expert
Expert

There should be some error messages in the catalina log file on the VA (/var/log/vcac/catalina.out)

If it's a serialization issue (according to the server) then double check the JSON body content (jsonviewer.stack.hu) and then double check all HTTP headers. At that stage it might be an SR if the server still refuses the content

Reply
0 Kudos
Govt_Matt
Contributor
Contributor

Was there a solution to this? I am looking to do the same thing in our environment

Reply
0 Kudos
kvardhan
Contributor
Contributor

Im facing this error. Can you help me on this?

{

    "errors": [

        {

            "code": 10104,

            "source": null,

            "message": "Data serialization error.",

            "systemMessage": "Could not read message [acceptableTypes: [application/*+json, application/json]]",

            "moreInfoUrl": null

        }

    ]

}

Reply
0 Kudos