Skip to content
Last updated

HPE GreenLake for Workspaces developer guide

The examples in this guide help you use the Workspace Management APIs for workspace and tenant management.

Prerequisites


Endpoints

Endpoints are the host URLs to which you will submit your API requests. To access Workspace Management APIs, use the unified API:

  • https://global.api.greenlake.hpe.com

URIs

Unique Resource Identifiers (URIs) are used to identify a server or resources. A URI is a full API path ending in an identification number. For example:

  • /workspaces/v1/msp-tenants/{tenantId}

Generating tokens

You must create a personal API client and generate an access token to make API calls. HPE GreenLake APIs use OAuth-based access tokens used as an authorization bearer token. To do this:

  1. Create a personal API client.
    • Select the HPE GreenLake Cloud Platform service.
  2. Generate an access token.
  3. Use the access token as an authorization bearer token to make secure REST API calls.

Making It All Work

Workspace

With the workspace API, you can discover information about the workspace the API is configured for.

Get basic workspace information

To see information on the workspace, submit the following GET request specifying the workspace ID:

GET https://global.api.greenlake.hpe.com/workspaces/v1/workspaces/<id>

This API call returns workspace information like ID, type, creation, created date and time, updated date and time, created by, and the workspace's name.

Sample response:

{
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "type": "string",
    "generation": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "workspaceName": "string",
    "createdBy": "user@example.com"
}

Get detailed workspace information

To retrieve the workspace address and contact details, use the following GET API call specifying the workspace ID:

GET https://global.api.greenlake.hpe.com/workspaces/v1/workspaces/<id>/contact

Sample response:

{
    "address": {
        "streetAddress": "string",
        "streetAddressComplement": "string",
        "city": "string",
        "stateOrRegion": "string",
        "zip": "string",
        "countryCode": "string"
    },
    "phoneNumber": "string",
    "email": "user@example.com"
}

Tenant management

With the tenant management APIs, you can:

  • Get a list of tenants
  • Create a tenant
  • Update tenant information
  • Delete a tenant

Obtain a list of tenants

To retrieve a list of tenants in a managed service provider (MSP) workspace, submit the following GET request:

GET https://global.api.greenlake.hpe.com/workspaces/v1/msp-tenants

This API call returns:

  • Workspace ID, workspace name, and creator
  • Pagination information: offset, count, items, and total

Sample response:

{
    "offset": 0,
    "count": 0,
    "total": 0,
    "items": [
        {
        "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
        "type": "string",
        "generation": 0,
        "createdAt": "2019-08-24T14:15:22Z",
        "updatedAt": "2019-08-24T14:15:22Z",
        "workspaceName": "string",
        "createdBy": "user@example.com"
        }
    ]
}

Create a tenant

To create a new tenant in an MSP workspace, submit a PUT request:

POST https://global.api.greenlake.hpe.com/workspaces/v1/msp-tenants

Payload:

{
    "address": {
        "streetAddress": "string",
        "streetAddressComplement": "string",
        "city": "string",
        "stateOrRegion": "string",
        "zip": "string",
        "countryCode": "AW"
    },
    "phoneNumber": "string",
    "email": "user@example.com",
    "workspaceName": "string",
    "description": "string"
}

A valid response generates a location header, and the response payload returns a tenant-created message.

Update tenant information

To update tenant information, submit the following PUT request:

PUT https://global.api.greenlake.hpe.com/workspaces/v1/msp-tenants/<id>

Payload:

{
    "address": {
        "streetAddress": "string",
        "streetAddressComplement": "string",
        "city": "string",
        "stateOrRegion": "string",
        "zip": "string",
        "countryCode": "AW"
    },
    "phoneNumber": "string",
    "email": "user@example.com",
    "workspaceName": "string",
    "description": "string"
}

The response payload returns a tenant-created message.

Delete a tenant

To delete a tenant from an MSP workspace, submit the following DELETE request specifying the path of the tenant id.

DELETE https://global.api.greenlake.hpe.com/workspaces/v1/msp-tenants/<id>