HPE GreenLake 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 configure API credentials and generate an access token to make API calls. HPE GreenLake APIs use OAuth-based access tokens used as an authorization bearer token.
To access the HPE GreenLake platform Workspace Management API, proceed as follows:
- Connect to the HPE GreenLake edge-to-cloud platform UI workspace.
- Go to Manage Workspace > API > Create Credentials .
- Select HPE GreenLake Platform from the Select Service Manager drop-down. If you do not see HPE GreenLake Platform as an option when configuring API client credentials, see the Getting Started Guide for more information.
- Enter the Credential Name .
- Click Create Credential .
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>