VMware Datacenters API

Datacenter management for organizing vSphere inventory

Documentation

Specifications

Code Examples

Schemas & Data

Other Resources

OpenAPI Specification

vmware-datacenters-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: VMware vSphere Automation REST Clusters Datacenters API
  description: RESTful API for managing VMware vSphere virtualization platform resources including virtual machines, hosts, datastores, clusters, networks, and related infrastructure. The vSphere Automation API provides modern REST endpoints for vCenter Server operations using JSON payloads and session-based or OAuth authentication. This API supersedes the legacy SOAP-based vSphere Web Services API for most automation use cases.
  version: '8.0'
  contact:
    name: Broadcom Developer Support
    url: https://developer.broadcom.com/
  license:
    name: Proprietary
    url: https://www.broadcom.com/company/legal/terms-of-use
  termsOfService: https://www.broadcom.com/company/legal/terms-of-use
servers:
- url: https://{vcenter}/api
  description: vCenter Server REST API endpoint
  variables:
    vcenter:
      default: vcenter.example.com
      description: Hostname or IP address of your vCenter Server instance
security:
- sessionAuth: []
- basicAuth: []
tags:
- name: Datacenters
  description: Datacenter management for organizing vSphere inventory
paths:
  /vcenter/datacenter:
    get:
      operationId: listDatacenters
      summary: Vmware List Datacenters
      description: Returns a list of datacenters in the vCenter inventory matching the specified filter criteria.
      tags:
      - Datacenters
      parameters:
      - name: filter.datacenters
        in: query
        description: Identifiers of datacenters to filter by
        schema:
          type: array
          items:
            type: string
        style: form
        explode: true
        example: []
      - name: filter.names
        in: query
        description: Names of datacenters to filter by
        schema:
          type: array
          items:
            type: string
        style: form
        explode: true
        example: []
      - name: filter.folders
        in: query
        description: Folders that must contain the datacenters
        schema:
          type: array
          items:
            type: string
        style: form
        explode: true
        example: []
      responses:
        '200':
          description: List of datacenters
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/DatacenterSummary'
              examples:
                Listdatacenters200Example:
                  summary: Default listDatacenters 200 response
                  x-microcks-default: true
                  value:
                  - datacenter: example_value
                    name: Example Title
        '401':
          description: Not authenticated
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    post:
      operationId: createDatacenter
      summary: Vmware Create a Datacenter
      description: Creates a new datacenter in the specified folder.
      tags:
      - Datacenters
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DatacenterCreateSpec'
            examples:
              CreatedatacenterRequestExample:
                summary: Default createDatacenter request
                x-microcks-default: true
                value:
                  name: Example Title
                  folder: example_value
      responses:
        '201':
          description: Datacenter created
          content:
            application/json:
              schema:
                type: string
                description: Identifier of the new datacenter
              examples:
                Createdatacenter201Example:
                  summary: Default createDatacenter 201 response
                  x-microcks-default: true
                  value: example_value
        '400':
          description: Invalid specification
        '401':
          description: Not authenticated
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /vcenter/datacenter/{datacenter}:
    get:
      operationId: getDatacenter
      summary: Vmware Get Datacenter Details
      description: Returns detailed information about the specified datacenter.
      tags:
      - Datacenters
      parameters:
      - $ref: '#/components/parameters/datacenterId'
      responses:
        '200':
          description: Datacenter details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DatacenterInfo'
              examples:
                Getdatacenter200Example:
                  summary: Default getDatacenter 200 response
                  x-microcks-default: true
                  value:
                    name: Example Title
                    datastore_folder: example_value
                    host_folder: example_value
                    network_folder: example_value
                    vm_folder: example_value
        '401':
          description: Not authenticated
        '404':
          description: Datacenter not found
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    delete:
      operationId: deleteDatacenter
      summary: Vmware Delete a Datacenter
      description: Deletes the specified datacenter. All hosts and VMs must be removed from the datacenter before deletion.
      tags:
      - Datacenters
      parameters:
      - $ref: '#/components/parameters/datacenterId'
      - name: force
        in: query
        description: Force delete even if datacenter is not empty
        schema:
          type: boolean
          default: false
        example: true
      responses:
        '204':
          description: Datacenter deleted
        '400':
          description: Datacenter is not empty
        '401':
          description: Not authenticated
        '404':
          description: Datacenter not found
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  schemas:
    DatacenterCreateSpec:
      type: object
      description: Specification for creating a datacenter
      required:
      - name
      - folder
      properties:
        name:
          type: string
          description: Name for the new datacenter
          example: Example Title
        folder:
          type: string
          description: Parent folder identifier
          example: example_value
    DatacenterInfo:
      type: object
      description: Detailed datacenter information
      properties:
        name:
          type: string
          description: Display name of the datacenter
          example: Example Title
        datastore_folder:
          type: string
          description: Datastore folder identifier
          example: example_value
        host_folder:
          type: string
          description: Host folder identifier
          example: example_value
        network_folder:
          type: string
          description: Network folder identifier
          example: example_value
        vm_folder:
          type: string
          description: VM folder identifier
          example: example_value
    DatacenterSummary:
      type: object
      description: Summary of a datacenter
      required:
      - datacenter
      - name
      properties:
        datacenter:
          type: string
          description: Unique identifier of the datacenter
          example: example_value
        name:
          type: string
          description: Display name of the datacenter
          example: Example Title
  parameters:
    datacenterId:
      name: datacenter
      in: path
      required: true
      description: Identifier of the datacenter (e.g., datacenter-2)
      schema:
        type: string
  securitySchemes:
    sessionAuth:
      type: apiKey
      in: header
      name: vmware-api-session-id
      description: Session token obtained from POST /session. Include this header in all subsequent API requests.
    basicAuth:
      type: http
      scheme: basic
      description: HTTP Basic authentication using vCenter Server credentials. Used primarily for creating sessions.
externalDocs:
  description: vSphere Automation API Reference on Broadcom Developer Portal
  url: https://developer.broadcom.com/xapis/vsphere-automation-api/latest/