RESTful knowledge exchange
Post Reply
rdock
Novice
Posts: 4
Liked: never
Joined: Apr 14, 2021 5:03 pm
Full Name: Rob Dock
Contact:

POST /api/cloud/tenants "Backup server id cannot be empty."

Post by rdock »

Hello!

I'm trying to automate the addition of VCC tenants via the Enterprise Manager API. I've successfully managed being able to pull out the information necessary to add in the tenant connected to the existing vCD Organization; however, when I POST the XML to the API, I'm getting an unexpected error:

Message="Backup server id cannot be empty." StatusCode="400" Status="BadRequest"

I have received this message before, but I actually didn't have the <BackupServerUid> field being properly filled in. I've since fixed that, but I'm getting the same error from the API.

I'm POSTing the following XML body to the /api/cloud/tenants page of the Enterprise Manager with the correct session cookie and Content-Type: application/xml in the headers:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<CreateCloudTenantSpec xmlns="http://www.veeam.com/ent/v1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Name>Tenant Name</Name>
    <Description>Created by VCC Automated Deployment Script.</Description>
    <Password>StrongPassword1234</Password>
    <Enabled>true</Enabled>
    <LeaseOptions Enabled="false" />
    <Resources>
        <BackupResource>
            <Name>Tenant-Name-repo</Name>
            <RepositoryUid>urn:veeam:Repository:xxxx</RepositoryUid>
            <QuotaMb>100</QuotaMb>
        </BackupResource>
    </Resources>
    <BackupServerUid>urn:veeam:BackupServer:xxxx</BackupServerUid>
    <MaxConcurrentTasks>4</MaxConcurrentTasks>
    <TenantType>vCD</TenantType>
    <OrganizationRef>urn:vCloud:Organization:xxxx.urn:vcloud:org:xxxx</OrganizationRef>
    <VCloudComputeResources>
        <VCloudComputeResource>
            <VirtualDataCenterRef>urn:vCloud:OrgVdc:xxxx.urn:vcloud:xxxx</VirtualDataCenterRef>
            <Enabled>true</Enabled>
            <AllocationModel>AllocationPool</AllocationModel>
            <UseNetworkFailoverResources>false</UseNetworkFailoverResources>
        </VCloudComputeResource>
    </VCloudComputeResources>
</CreateCloudTenantSpec>
From what I'm able to find on the Help Center (https://helpcenter.veeam.com/docs/backu ... 110#vcloud), it doesn't make it seem like <BackupServerUid> is actually required.

Am I misunderstanding the error message? Is there another field I'm missing?

Thanks!

-- Rob
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: POST /api/cloud/tenants "Backup server id cannot be empty."

Post by oleg.feoktistov »

Hi Rob,

No, you are interpreting the message correctly. It refers to BackupServerUid missing.
Since I was able to reproduce it in my lab, I've brought up 2 questions internally:
- Why BackupServerUid field is not recognized in XML by the backend controller.
- Whether this field is required.

As soon as I have the answer, I'll update the thread.

By the way, I tried the same with JSON spec and didn't encounter the message in case BackupServerUid is present.
Maybe it is worth going the JSON way as a workaround for now.

Thanks,
Oleg
rdock
Novice
Posts: 4
Liked: never
Joined: Apr 14, 2021 5:03 pm
Full Name: Rob Dock
Contact:

Re: POST /api/cloud/tenants "Backup server id cannot be empty."

Post by rdock »

Oleg,

Thanks for checking and the reply! I'm glad to hear it's not just me :)

Regarding the JSON body, one of the XML tags is <CreateCloudTenantSpec> with some XML schema info. Is this required in the JSON, or will it just look like this in the body:

Code: Select all

{
    "Name": "Tenant Name",
    "Description": "Created by VCC Automated Deployment Script.",
    "Password": "StrongPassword1234",
    "Enabled": "true",
    "LeaseOptions": {
        "@Enabled": "false"
    },
    "Resources": {
        "BackupResource": {
            "Name": "Tenant-Name-repo",
            "RepositoryUid": "urn:veeam:Repository:xxxx",
            "QuotaMb": "100"
        }
    },
    "BackupServerUid": "urn:veeam:BackupServer:xxxx",
    "MaxConcurrentTasks": "4",
    "TenantType": "vCD",
    "OrganizationRef": "urn:vCloud:Organization:xxxx.urn:vcloud:org:xxxx",
    "VCloudComputeResources": {
        "VCloudComputeResource": {
            "VirtualDataCenterRef": "urn:vCloud:OrgVdc:xxxx.urn:vcloud:xxxx",
            "Enabled": "true",
            "AllocationModel": "AllocationPool",
            "UseNetworkFailoverResources": "false"
        }
    }
}
The Help Center article doesn't specify any additional tags like what it does for the XML version, but I just wanted to be sure.

Thanks!

-- Rob
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: POST /api/cloud/tenants "Backup server id cannot be empty."

Post by oleg.feoktistov »

No, these object tags cannot be recognized in JSON. Curly braces are used instead. Thanks!
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: POST /api/cloud/tenants "Backup server id cannot be empty."

Post by oleg.feoktistov » 1 person likes this post

Confirmed with QA that BackupServerUid field not being recognized in XML by the backend controller is a bug. The fix is planned for vNext. We also discovered that this field should be required, so tech writers team fixed the documentation. Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests