Syntax for Requesting a New Tenant

PUT /api/tenants/{tenantId} submits a request to create or update a tenant. You can specify request parameters using JSON command line input or by calling an existing JSON file from the command line.

Input

Use the supported input parameters to control the command output.

Parameter Description
URL https://$vRA/identity/api/tenants/$tenantId --data @$inputFileName.json
$vRA

Specifies the appliance name and fully qualified domain name, or IP address of the vRealize Automation server.

$token

Specifies a valid HTTP bearer token with necessary credentials.

$tenantId

Specifies the ID of the tenant.

$tenantURL

Specifies the URL of the tenant.

$tenantName

Specifies the name of the tenant.

$description

Specifies a description of the tenant.

$emailAddress

Specifies the contact email address for the tenant.

$password Optional password for the new tenant. If blank, no password is required.

JSON Input File Template

To simplify command line input, you can call a JSON file with input parameters from the command line. You create the JSON file using a text editor, replacing italicized variables in the following template with your specific values.

{
   "@type" : "Tenant",
   "id" : "$tenantId",
   "urlName" : "$tenantURL",
   "name" : "$tenantName",
   "description" : "$description",
   "contactEmail" : "$emailAddress",
   "password": "$password",
   "defaultTenant" : false
}

Output

The command output contains property names and values based on the command input parameters.

Parameter Description

Links

Specifies an array of link objects, each of which contains the following parts:

  • rel: Specifies the name of the link.
    • Self refers to the object that was returned or requested. This parameter does not appear when you query a single profile.
    • First, Previous, Next, and Last refer to corresponding pages of pageable lists.
    • Specifies the application or service that determines the other names.
  • href: Specifies the URL that produces the result.

Content

Specifies an array of data rows, each of which represents one of the tenant objects returned in a pageable list. Each tenant object can contain the following information:

  • Id: Specifies the unique tenant identifier.
  • urlName: Specifies the name of the tenant as it appears in URLs.
  • Name: Specifies the name of the tenant for display purposes.
  • description: Specifies the long description of the tenant.
  • contactEmail: Specifies the primary contact email address.
  • Password: Unused
  • defaultTenant: Is set to True if the corresponding tenant is the default tenant (vsphere.local).

Metadata

Specifies the following paging-related data:
  • Size: Specifies the maximum number of rows per page.
  • totalElement: Specifies the number of rows returned. This parameter is not output when you query for a single profile.
  • totalPages: Specifies the total number of pages of data available.
  • Number: Specifies the current page number.
  • Offset: Specifies the number of rows skipped.

curl Command to Request a New Tenant With JSON File

The following sample newTenant.json file contains parameters for the tenant request.

{
    "@type" : "Tenant",
    "id" : "rainpole",
    "urlName" : "rainpole",
    "name" : "rainpoleTenant",
    "description" : "New Custom Tenant",
    "contactEmail" : null,
    "password": "",
    "defaultTenant" : true
}

The following example command requests a new tenant by calling the newTenant.json file.

curl --insecure -H "Content-Type: application/json" -H "Authorization: Bearer $token" https://$vRA/identity/api/tenants/rainpole --data @C:\Temp\newTenant.json

curl Command to Request a New Tenant With Parameters Inline

The following example command requests a new tenant with input parameters specified inline.

curl --insecure -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer $token" https://$vRA/identity/api/tenants/rainpole --data '{"@type":"Tenant","id":"rainpole","urlName":"rainpole","name":"rainpoleTenant",
"description":"New Custom Tenant","contactEmail":null,"defaultTenant":false}'