The examples in this guide help you use the Workspace Management APIs for workspace and tenant management.
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
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}
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:
- Create a personal API client.
- Select the HPE GreenLake Cloud Platform service.
- Generate an access token.
- Use the access token as an authorization bearer token to make secure REST API calls.
With the workspace API, you can discover information about the workspace the API is configured for.
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"
}
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"
}
With the tenant management APIs, you can:
- Get a list of tenants
- Create a tenant
- Update tenant information
- Delete a tenant
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"
}
]
}
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.
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.
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>