REST API knowledge exchange
Post Reply
paulmcnally
Service Provider
Posts: 14
Liked: never
Joined: Feb 26, 2020 10:19 am
Full Name: Paul McNally
Contact:

Error converting value to type 'Veeam.Backup.Interaction.RestAPI.Resources.CloudHardwarePlanCreateSpecType

Post by paulmcnally »

Hi, please can somebody help me? I'm trying to create a hardware plan via the API using JSON but I'm getting a 400 response. Is there something I'm missing? Here is my request:

'POST', 'api/cloud/hardwarePlans'

Code: Select all

{
  "BackupServerUid": "urn:veeam:BackupServer:33fd1ec4-37fd-4566-8652-2cf497cfe44e",
  "Name": "paul-test-1",
  "Description": "Testing creating a hardware plan from the veeam API",
  "ProcessorUsageLimitMhz": 1000,
  "MemoryUsageLimitMb": 2000,
  "HardwarePlanDetails": {
    "ViCloudHardwarePlan": {
      "HypervisorHostRef": "urn:VMware:Cluster:554cac72-2924-4b83-90c5-65a3cdb70074.domain-c68217",
      "ParentType": "ClusterComputeResource",
      "ParentName": "Shared",
      "Datastores": {
        "Datastores": [
          {
            "FriendlyName": "Pauls datastore friendly name 1",
            "DatastoreType": "StoragePod",
            "Reference": "urn:VMware:StoragePod:554cac72-2924-4b92-90c5-65a3cdb70086.group-p84579",
            "QuotaGb": 500
          }
        ]
      },
      "Network": {
        "CountWithInternet": 1,
        "CountWithoutInternet": 1
      }
    }
  }
}
...and here is the response:

Code: Select all

stdClass Object
(
    [FirstChanceExceptionMessage] => 
    [StackTrace] => 
    [Message] => spec : Error converting value "{...JSON ABOVE..
}" to type 'Veeam.Backup.Interaction.RestAPI.Resources.CloudHardwarePlanCreateSpecType'. Path '', line 1, position 990. 
    [StatusCode] => 400
    [Status] => BadRequest
)
I'm not sure where I'm going wrong here? Any suggestions would be appreciated?

Also, it would be nice if there were some more JSON examples in the docs.

Many thanks.
paulmcnally
Service Provider
Posts: 14
Liked: never
Joined: Feb 26, 2020 10:19 am
Full Name: Paul McNally
Contact:

Re: Error converting value to type 'Veeam.Backup.Interaction.RestAPI.Resources.CloudHardwarePlanCreateSpecType

Post by paulmcnally »

Found the problem, it was a Guzzle client issue. Not sure how you delete a post from here though.

But the comment about more JSON examples in the docs still stands, would be nice :)
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Error converting value to type 'Veeam.Backup.Interaction.RestAPI.Resources.CloudHardwarePlanCreateSpecType

Post by veremin »

Glad to hear that you've sorted it out.

I've passed your comment to the technical writers.

Just so you know next time you can submit your comments regarding documentation directly to the responsible individuals by using "Send feedback" form available at the bottom of every User Guide page.

Thanks!
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Error converting value to type 'Veeam.Backup.Interaction.RestAPI.Resources.CloudHardwarePlanCreateSpecType

Post by veremin »

The technical writers have head the feedback; they are planning to provide more JSON-examples with the next major product release. Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest