Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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:

FieldTypeDescription
serviceProviderIdLong/NumericAuto generated provider id.
nameStringA human friendly name for recognizing the service provider record.
contactNameStringAgent or representative of the Service Provider.
contactEmailStringEmail address for contacting the Service Provider.
contactPhoneStringA phone number for contacting the Service Provider.
templateProjectIdLong/NumericOptional field that maps to a project owned by the serviceProvider and to be used as a "template" to create other projects.
apiKeyStringThe access key for making api calls to the Service Provider API.
dateCreatedString/DateThe timestamp of when this Service Provider record was created.
dateUpdatedString/DateThe timestamp of the last time this Service Provider record was updated.

Supported APIs

API NameMethodURLDescription
Get ServiceProvider DetailsGET<hostname>/portal/service/:serviceProviderIdReturns the metadata saved in the system about the ServiceProvider.
Get List of Managed ProjectsGET<hostname>/portal/service/:serviceProviderId/projectsList of Projects managed by this ServiceProvider
Get a Managed ProjectGET<hostname>/portal/service/:serviceProviderId/projects/:projectIdGet the details about a single Project managed by this ServiceProvider
Create a ProjectPOST<hosthame>/portal/service/:serviceProviderId/projects/_createCreate a new managed Project using the values supplied in the request object.
Delete a ProjectDELETE<hostname>/portal/service/:serviceProviderId/projects/:projectIdDelete a managed project.

Examples

Get Service Provider Details

Request

API Call

Code Block
languagebash
curl -X GET \
$BLUZONE_URL/portal/service/1 \
-H 'bzspid: example-api-key' \
-H 'cache-control: no-cache' 

Response

Code Block
languagejs
titleService Provider Response
{
    "serviceProviderId": 1,
    "name": "Example",
    "contactName": "John Doe",
    "contactEmail": "john.doe@example.com",
    "contactPhone": "+3055551212",
    "templateProjectId": null,
    "dateCreated": 1507252266000,
    "dateUpdated": 1507252266000
}

Create Managed Project API

FieldTypeDescription
serviceProviderIdNumericRequired ServiceProvider Id value.
projectNameStringUser friendly name to help identify this project - usually the company name and type, example:  Acme Prod
defaultOwnerEmailStringOptional value that can be used as the Project owner's email and the username to login to the project.
defaultOwnerPasswordStringOptional value that can be used for the user to login to the project via Bluzone  Console.
joinAccountsEnabledBooleanDefault is false.  When set to true, the system will associate projects with the same username as the owner.
debugEnabledBoolean 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
languagebash
titleCreate Managed Project API
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 JSON

Body

Code Block
languagejs
titleCreate Managed Project Request
{
	"projectName": "SP Create Test 0",
	"defaultOwnerEmail": "ower@example.com",
	"defaultOwnerPassword": "changeme",
	"joinAccountsEnabled": false,
	"debugEnabled": true
}

Response

in JSON

Code Block
languagejs
titleCreate Managed Project Response
{
    "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
languagebash
titleList Managed Projects API
curl -X GET \
  $BLUZONE_URL/portal/service/1/projects \
  -H 'bzspid: example-api-key' \
  -H 'cache-control: no-cache' 
Managed Projects

Response

Code Block
languagejs
titleList Managed Projects Response
[
    {
        "serviceProviderId": 1,
        "projectId": 2178,
        "accountId": 1823,
        "username": "owner@example.com",
        "projectName": "SP Create Test 0",
        "projectApiKey": "MZP9VuQxDX0MMU6eJn2SDvX0FsY4jUx2lqko8TWcDRZC7ByhU2",
        "debugEnabled": true,
        "dateCreated": 1507641990000,
        "dateUpdated": 1507641990000
    }
]