1. Operations
2. vcenter
3. datacenter

## vcenter datacenter: create

Create a new datacenter in the vCenter inventory

### Request:

#### HTTP request

POST https://{server}/rest/vcenter/datacenter

#### Request Body Structure:

- JSON
- XML

{
"spec": {
"folder": "obj-103",
"name": "string"
}
}
<?xml version="1.0" ?>
<ns0:Create-Input xmlns:ns0="http://vmware.com/vcenter/datacenter" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<spec>
<folder>obj-103</folder>
<name>string</name>
</spec>
</ns0:Create-Input>

#### Request Body Parameters:

Name | Type | Description
--- | --- | ---
bold = required
spec | create_spec | Specification for the new datacenter to be created.
spec.name | string | The name of the datacenter to be created.
spec.folder | string | Datacenter folder in which the new datacenter should be created. Optional. This field is currently required. In the future, if this field is unset, the system will attempt to choose a suitable folder for the datacenter; if a folder cannot be chosen, the datacenter creation operation will fail.When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: `Folder`. When operations return a value of this structure as a result, the field will be an identifier for the resource type: `Folder`.

### Response:

#### HTTP Status Code: 200

#### Representations:

- JSON
- XML

{
"value": "obj-103"
}
<?xml version="1.0" ?>
<ns0:Create-Result xmlns:ns0="http://vmware.com/vcenter/datacenter" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<value>obj-103</value>
</ns0:Create-Result>

#### Response Type:

Name | Type | Description
--- | --- | ---
bold = required
value | string | The identifier of the newly created datacenter.

#### Errors:

HTTP Status Code | Type | Description
--- | --- | ---
500 | error | if the system reports an error while responding to the request.
400 | already_exists | if the datacenter with the same name is already present.
400 | invalid_argument | if the datacenter name is empty or invalid as per the underlying implementation.
404 | not_found | if the datacenter folder cannot be found.
503 | service_unavailable | if the system is unable to communicate with a service to complete the request.
401 | unauthenticated | if the user can not be authenticated.
403 | unauthorized | if the user doesn't have the required privileges.