Common API examples

Setting the AdminUp status for a deployment

The following example shows the API call used to setting a deployment's AdminUp state to True.

First, query the deployments to find the relevant deployment:
REQUEST: GET http://fss.nokia.com/rest/connect/api/v1/admin/deployments?name=test
 
RESPONSE:
[{
  "id": "421602784727531649",
  "name": "test",
  "pluginID": "421602784693977217",
  "description": "test:description",
  "adminUp": false,
  "settings": {},
  "externalId": "test:deployment:ext_id",
  "status": "Deployed"
}]
 

Alternatively, query the deployment with a specific ID to verify the current AdminUp status:

REQUEST: GET http://fss.nokia.com/rest/connect/api/v1/admin/deployments/421602784727531649
 
RESPONSE:
{
  "id": "421602784727531649",
  "name": "test",
  "pluginID": "421602784693977217",
  "description": "test:description",
  "adminUp": false,
  "settings": {},
  "externalId": "test:deployment:ext_id",
  "status": "Deployed"
}
 

Then, set the AdminUp status to True:

REQUEST: PUT http://fss.nokia.com/rest/connect/api/v1/admin/deployments/421602784727531649
 
{
  "id": "421602784727531649",
  "name": "Updated:test:deployment",
  "pluginID": "421602784693977217",
  "description": "Updated:test:deployment:description",
  "adminUp": true,
  "settings": {},
  "externalId": "test:deployment:ext_id",
  "status": "Deployed"
}
 
RESPONSE:
{
  "id": "421602784727531649",
  "name": "Updated:test:deployment",
  "pluginID": "421602784693977217",
  "description": "Updated:test:deployment:description",
  "adminUp": true,
  "settings": {},
  "externalId": "test:deployment:ext_id",
  "status": "Deployed"
}

Creating a Deployment (for VMware Plugin)

The VMware plugin requires the operator to create a Deployment, as it is not tied to the VCenter itself, but rather runs in the Fabric Services System environment.

First, get the Plugin for which you are creating a Deployment:
REQUEST: GET http://fss.nokia.com/rest/connect/api/v1/admin/connecttypes
 
RESPONSE:
["OpenStack", "k8s-connect", "vmware"]
 
In this example, we are trying to create a Deployment on VMware. To do this, we first GET all available VMware plugins:
REQUEST: GET http://fss.nokia.com/rest/connect/api/v1/admin/plugins?connecttype=vmware
 
RESPONSE:
[
{ "id": "436378098703794176",
   "connectType": "vmware",
   "name": "vmware",
   "externalId": "vmware",
   "possibleSettings": [
      { "name": "host", "required": true, "description": "vCenter host", "unique": true, "example": "vmware.example.net", "encrypted": false },
      { "name": "username", "required": true, "description": "vCenter user", "unique": false, "example": "admin", "encrypted": false },
      { "name": "password", "required": true, "description": "Password of the vCenter user", "unique": false, "example": "secret", "encrypted": true }
   ],
   "supportsHeartbeat": true,
   "heartbeatInterval": 1,
   "supportedActionables": [ "DEPLOYMENT_CREATED", "DEPLOYMENT_DELETED", "DEPLOYMENT_UPDATED" ],
    "status": "Deployed" }
]
 
Based on the information contained in the plugin, we can create a Deployment. To create a Deployment, we need to follow the rules the plugin specified in the settings field. In this example we need the "host", "username" and "password" settings.
REQUEST: POST http://fss.nokia.com/rest/connect/api/v1/admin/deployments/
 
{ "adminUp": true,
  "description": "demo-deployment",
  "externalId": "demo-external-id",
  "name": "demo-deployment",
  "pluginID": "436378098703794176",
  "settings": { "password": "PASSWORD", "host": "vsphere", "username": "administrator@vsphere.local" }
}
 
RESPONSE:
{ "id": "436401371051196416",
  "name": "demo-deployment",
  "pluginID": "436378098703794176",
  "description": "demo-deployment",
  "adminUp": true,
  "settings": { "host": "vsphere.local", "password": "PASSWORD", "username": "administrator@vsphere.local" },
  "externalId": "demo-external-id",
  "status": "Deployed"
}