Table of Contents |
---|
Inception
Resellers of Bluzone Cloud services (Service Providers) need an efficient way to create and manage projects on behalf of their end users. The Service Provider API enables project creation and management via a secure REST API.
Business Requirements
Service Providers must be able to create and manage projects with a REST API. The API shall support querying of Service Provider details, listing of managed projects, creation of managed projects and deletion of managed projects. The Service Provider API shall expose templating features
Elaboration
The Service Provider API is enabled for end users via a manual configuration step by Bluzone Administrators.
Service Provider Record
A Service Provider record is created in the main database. An API Key is generated and saved in the database, along with contact information about the Service Provider:
Field | Type | Description |
---|---|---|
serviceProviderId | Long/Numeric | Auto generated provider id. |
name | String | A human friendly name for recognizing the service provider record. |
contactName | String | Agent or representative of the Service Provider. |
contactEmail | String | Email address for contacting the Service Provider. |
contactPhone | String | A phone number for contacting the Service Provider. |
templateProjectId | Long/Numeric | Optional field that maps to a project owned by the serviceProvider and to be used as a "template" to create other projects. |
apiKey | String | The access key for making api calls to the Service Provider API. |
dateCreated | String/Date | The timestamp of when this Service Provider record was created. |
dateUpdated | String/Date | The timestamp of the last time this Service Provider record was updated. |
Supported APIs
API Name | Method | URL | Description |
---|---|---|---|
Get ServiceProvider Details | GET | <hostname>/portal/service/:serviceProviderId | Returns the metadata saved in the system about the ServiceProvider. |
Get List of Managed Projects | GET | <hostname>/portal/service/:serviceProviderId/projects | List of Projects managed by this ServiceProvider |
Get a Managed Project | GET | <hostname>/portal/service/:serviceProviderId/projects/:projectId | Get the details about a single Project managed by this ServiceProvider |
Create a Project | POST | <hosthame>/portal/service/:serviceProviderId/projects/_create | Create a new managed Project using the values supplied in the request object. |
Delete a Project | DELETE | <hostname>/portal/service/:serviceProviderId/projects/:projectId | Delete a managed project. |
Examples
Get Service Provider Details
RequestAPI Call
Code Block | ||
---|---|---|
| ||
curl -X GET \ $BLUZONE_URL/portal/service/1 \ -H 'bzspid: example-api-key' \ -H 'cache-control: no-cache' |
Response
Code Block | ||||
---|---|---|---|---|
| ||||
{ "serviceProviderId": 1, "name": "Example", "contactName": "John Doe", "contactEmail": "john.doe@example.com", "contactPhone": "+3055551212", "templateProjectId": null, "dateCreated": 1507252266000, "dateUpdated": 1507252266000 } |
Create Managed Project API
Field | Type | Description |
---|---|---|
serviceProviderId | Numeric | Required ServiceProvider Id value. |
projectName | String | User friendly name to help identify this project - usually the company name and type, example: Acme Prod |
defaultOwnerEmail | String | Optional value that can be used as the Project owner's email and the username to login to the project. |
defaultOwnerPassword | String | Optional value that can be used for the user to login to the project via Bluzone Console. |
joinAccountsEnabled | Boolean | Default is false. When set to true, the system will associate projects with the same username as the owner. |
debugEnabled | Boolean | Default false. When true, the user will be able to login to this project via Bluzone Console using the provided defaultOwnerEmail as username and defaultOwnerPassword as password |
API Call
Code Block | ||||
---|---|---|---|---|
| ||||
curl -X POST \ $BLUZONE_URL/portal/service/1/projects/_create \ -H 'bzspid: example-api-key' \ -H 'cache-control: no-cache' \ -H 'content-type: application/json' \ -d '{ "projectName": "SP Create Test 0", "defaultOwnerEmail": "owner0@example.com", "defaultOwnerPassword": "changeme", "joinAccountsEnambed": false, "debugEnabled": true }' |
Request
in JSONBody
Code Block | ||||
---|---|---|---|---|
| ||||
{ "projectName": "SP Create Test 0", "defaultOwnerEmail": "ower@example.com", "defaultOwnerPassword": "changeme", "joinAccountsEnabled": false, "debugEnabled": true } |
Response
in JSONCode Block | ||||
---|---|---|---|---|
| ||||
{ "serviceProviderId": 1, "projectId": 2178, "accountId": 1823, "username": null, "projectName": "SP Create Test 0", "projectApiKey": "MZP9VuQxDX0MMU6eJn2SDvX0FsY4jUx2lqko8TWcDRZC7ByhU2", "debugEnabled": true, "dateCreated": 1507641990350, "dateUpdated": 1507641990350 } |
List All Managed Projects
API Call
Code Block | ||||
---|---|---|---|---|
| ||||
curl -X GET \ $BLUZONE_URL/portal/service/1/projects \ -H 'bzspid: example-api-key' \ -H 'cache-control: no-cache' |
Response
Code Block | ||||
---|---|---|---|---|
| ||||
[ { "serviceProviderId": 1, "projectId": 2178, "accountId": 1823, "username": "owner@example.com", "projectName": "SP Create Test 0", "projectApiKey": "MZP9VuQxDX0MMU6eJn2SDvX0FsY4jUx2lqko8TWcDRZC7ByhU2", "debugEnabled": true, "dateCreated": 1507641990000, "dateUpdated": 1507641990000 } ] |