PASubscription

This type represents a Operations Automation subscription.

GraphViz

Schema

The considered APS type (download) extends the Subscription APS type(s) and looks as follows:

{
  "name": "PASubscription",
  "id": "http://parallels.com/aps/types/pa/subscription/1.0",
  "apsVersion": "2.0",
  "implements": [
    "http://aps-standard.org/types/core/subscription/1.0"
  ],
  "relations": {
    "account": {
      "type": "http://aps-standard.org/types/core/account/1.0",
      "required": true
    },
    "websites": {
      "type": "http://parallels.com/aps/types/pa/website/1.0",
      "collection": true
    }
  },
  "properties": {
    "subscriptionId": {
      "type": "integer",
      "required": true,
      "final": true
    },
    "serviceTemplateId": {
      "type": "integer",
      "required": true
    },
    "isTerminated": {
      "type": "boolean"
    },
    "activationStructure": {
      "type": "ActivationStructure"
    },
    "oneTime": {
      "type": "boolean"
    }
  },
  "operations": {
    "provisioningState": {
      "path": "/provisioningState",
      "verb": "GET",
      "response": {
        "type": "ProvisioningState"
      },
      "errorResponse": {
        "type": "object"
      }
    },
    "restartProvisioning": {
      "path": "/restartProvisioning",
      "verb": "POST",
      "errorResponse": {
        "type": "object"
      }
    },
    "hold": {
      "path": "/hold",
      "verb": "POST",
      "errorResponse": {
        "type": "object"
      }
    },
    "release": {
      "path": "/release",
      "verb": "POST",
      "errorResponse": {
        "type": "object"
      }
    },
    "applications": {
      "path": "/applications",
      "verb": "GET",
      "response": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "errorResponse": {
        "type": "object"
      }
    }
  },
  "structures": {
    "ActivationStructure": {
      "type": "object",
      "properties": {
        "domainApsId": {
          "type": "string"
        },
        "subscriptionResourceLimits": {
          "type": "array",
          "items": {
            "type": "SubscriptionResourceLimit"
          }
        },
        "apsDefaults": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "SubscriptionResourceLimit": {
      "type": "object",
      "properties": {
        "resourceId": {
          "type": "integer",
          "required": true
        },
        "resourceLimit": {
          "type": "integer",
          "required": true
        }
      }
    },
    "ProvisioningState": {
      "type": "object",
      "properties": {
        "state": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    }
  }
}

The APS type is used to manage a collection of APS resources. To get a list of resources from that collection, use the following API call:

GET  /aps/2/collections/pa-subscriptions?<RQL-filter>

Properties

NAME

TYPE

ATTRIBUTES

DEFAULT

DESCRIPTION

subscriptionId

Integer

Required Final

Subscription identifier in OA

serviceTemplateId

Integer

Required

Service Template Id in OA

isTerminated

Boolean

Not Required

activationStructure

ActivationStructure

Not Required

Subscription activation parameters

oneTime

Boolean

Not Required

Relationship

NAME

TYPE

REQUIRED

DESCRIPTION

account

Account

Yes

Account owns the subscription

websites

Collection of http://parallels.com/aps/types/pa/website

No

Websites collection

Custom Operations

OPERATION

VERB

PATH

RETURNS

Description

provisioningState

GET

/provisioningState

ProvisioningState

Custom operation to check provisioning state of subscription

restartProvisioning

POST

/restartProvisioning

If successful, this method returns a 200 OK standard status code

Custom operation for restarting subscription provisioning in case it’s failed

hold

POST

/hold

Put subscription on hold in BSS

release

POST

/release

Release subscription from hold in BSS

applications

GET

/applications

If successful, this method returns collection of application IDs in response body

Get APS applications related to subscription

provisioningState

HTTP Request

GET /aps/2/resources/{aps-id}/provisioningState

Description

Custom operation to check provisioning state of subscription

Returns

ProvisioningState

restartProvisioning

HTTP Request

POST /aps/2/resources/{aps-id}/restartProvisioning

Description

Custom operation for restarting subscription provisioning in case it’s failed

Returns

If successful, this method returns a 200 OK standard status code

hold

HTTP Request

POST /aps/2/resources/{aps-id}/hold

Description

Put subscription on hold in BSS

Returns

release

HTTP Request

POST /aps/2/resources/{aps-id}/release

Description

Release subscription from hold in BSS

Returns

applications

HTTP Request

GET /aps/2/resources/{aps-id}/applications

Description

Get APS applications related to subscription

Returns

If successful, this method returns collection of application IDs in response body

Structures

ActivationStructure

Structure for activation parameters

NAME

TYPE

ATTRIBUTES

DEFAULT

DESCRIPTION

domainApsId

String

Not Required

Domain aps id for binding services to domain

subscriptionResourceLimits

Array of SubscriptionResourceLimit

Not Required

Limit of resources to provide

apsDefaults

Array of String

Not Required

APS defaults structure for activation subscription with provisioning parameters

SubscriptionResourceLimit

Structure for resource limits

NAME

TYPE

ATTRIBUTES

DEFAULT

DESCRIPTION

resourceId

Integer

Required

Internal resource id

resourceLimit

Integer

Required

Resource Limit

ProvisioningState

Current subscription provisioning state structure

NAME

TYPE

ATTRIBUTES

DEFAULT

DESCRIPTION

state

String

Not Required

Current provisioning state of the subscription

message

String

Not Required

If provisioning is failed this field will contains error message

Examples

Get Subscriptions

The following command retrieves all subscriptions except for the provider’s built-in subscription whose ID is 1.

Request:

GET /aps/2/collections/subscriptions?ne(subscriptionId,1)

Sample response:

[
  {
    "aps": {
      "type": "http://parallels.com/aps/types/pa/subscription/1.0",
      "id": "0ad9545b-03fe-4421-8179-d174e58d2e93",
      "status": "aps:ready",
      "revision": 3,
      "modified": "2016-11-07T15:40:33Z"
    },
    "description": "",
    "disabled": false,
    "name": "Generic",
    "serviceTemplateId": 6,
    "subscriptionId": 13,
    "trial": false
  },
  {
    "aps": {
      "type": "http://parallels.com/aps/types/pa/subscription/1.0",
      "id": "fd50635c-e9be-494b-887c-e3bcaa86450e",
      "status": "aps:ready",
      "revision": 3,
      "modified": "2016-11-15T09:58:34Z"
    },
    "description": "",
    "disabled": false,
    "name": "Home Dashboard",
    "serviceTemplateId": 5,
    "subscriptionId": 14,
    "trial": false
  },
  {
    "aps": {
      "type": "http://parallels.com/aps/types/pa/subscription/1.0",
      "id": "d1d637c9-4b67-4045-be19-2f2f0f513288",
      "status": "aps:ready",
      "revision": 3,
      "modified": "2016-11-15T10:14:14Z"
    },
    "description": "",
    "disabled": false,
    "name": "Testing Offers",
    "serviceTemplateId": 7,
    "subscriptionId": 16,
    "trial": false
  }
]

Select Subscriptions by Service Template

The serviceTemplateId property in the subscriptions allows selecting all subscriptions created from a certain service template. The following request retrieves all subscriptions created from the service template whose ID in the platform is 7.

Request:

GET /aps/2/collections/subscriptions?eq(serviceTemplateId,7)

The following response shows that only one subscription is based on the specified service template:

[
  {
    "aps": {
      "type": "http://parallels.com/aps/types/pa/subscription/1.0",
      "id": "d1d637c9-4b67-4045-be19-2f2f0f513288",
      "status": "aps:ready",
      "revision": 3,
      "modified": "2016-11-15T10:14:14Z"
    },
    "description": "",
    "disabled": false,
    "name": "Testing Offers",
    "serviceTemplateId": 7,
    "subscriptionId": 16,
    "trial": false
  }
]

Select Subscriptions by Account

Use the select RQL function to list all subscriptions along with the linked accounts, but show only the account companyName:

Request:

GET /aps/2/collections/subscriptions?select(account.companyName)

In the response, you will find not only the properties of every subscription but also the name of the account company that is the owner of the subscription and is linked with the latter:

[
  {
    "aps": {
      "type": "http://parallels.com/aps/types/pa/subscription/1.0",
      "id": "0ad9545b-03fe-4421-8179-d174e58d2e93",
      "status": "aps:ready",
      "revision": 3,
      "modified": "2016-11-07T15:40:33Z"
    },
    "description": "",
    "disabled": false,
    "name": "Generic",
    "serviceTemplateId": 6,
    "subscriptionId": 13,
    "trial": false,
    "account": {
      "aps": {
        "type": "http://parallels.com/aps/types/pa/account/1.2",
        "id": "0e16f418-704c-41d4-b30e-39b048e4b82e",
        "status": "aps:ready",
        "revision": 2,
        "modified": "2016-10-21T13:25:26Z"
      },
      "companyName": "1st APS inc."
    }
  },
  ...
]

To list the subscriptions of a certain customer, filter the subscriptions by the account.aps.id or account.companyName property as in the following example.

Request:

GET /aps/2/collections/subscriptions?select(account.companyName),eq(account.companyName,1st%20APS%20inc.)

The response contains the subscriptions of the specified company:

[
  {
    "aps": {
      "type": "http://parallels.com/aps/types/pa/subscription/1.0",
      "id": "0ad9545b-03fe-4421-8179-d174e58d2e93",
      "status": "aps:ready",
      "revision": 3,
      "modified": "2016-11-07T15:40:33Z"
    },
    "serviceTemplateId": 6,
    "subscriptionId": 13,
    "trial": false,
    "description": "",
    "disabled": false,
    "name": "Generic",
    "account": {
      "aps": {
        "type": "http://parallels.com/aps/types/pa/account/1.2",
        "id": "0e16f418-704c-41d4-b30e-39b048e4b82e",
        "status": "aps:ready",
        "revision": 2,
        "modified": "2016-10-21T13:25:26Z"
      },
      "companyName": "1st APS inc."
    }
  },
  {
    "aps": {
      "type": "http://parallels.com/aps/types/pa/subscription/1.0",
      "id": "d1d637c9-4b67-4045-be19-2f2f0f513288",
      "status": "aps:ready",
      "revision": 3,
      "modified": "2016-11-15T10:14:14Z"
    },
    "description": "",
    "disabled": false,
    "name": "Testing Offers",
    "serviceTemplateId": 7,
    "subscriptionId": 16,
    "trial": false,
    "account": {
      "aps": {
        "type": "http://parallels.com/aps/types/pa/account/1.2",
        "id": "0e16f418-704c-41d4-b30e-39b048e4b82e",
        "status": "aps:ready",
        "revision": 2,
        "modified": "2016-10-21T13:25:26Z"
      },
      "companyName": "1st APS inc."
    }
  },
  {
    "aps": {
      "type": "http://parallels.com/aps/types/pa/subscription/1.0",
      "id": "f95113fb-9b24-4669-8b26-17cb237fd79e",
      "status": "aps:ready",
      "revision": 3,
      "modified": "2016-11-15T12:53:27Z"
    },
    "description": "",
    "disabled": false,
    "name": "Offer-Counter-Users",
    "serviceTemplateId": 8,
    "subscriptionId": 17,
    "trial": false,
    "account": {
      "aps": {
        "type": "http://parallels.com/aps/types/pa/account/1.2",
        "id": "0e16f418-704c-41d4-b30e-39b048e4b82e",
        "status": "aps:ready",
        "revision": 2,
        "modified": "2016-10-21T13:25:26Z"
      },
      "companyName": "1st APS inc."
    }
  }
]

Get Resource Usage

Since the platform subscription APS type implements the standard subscription APS type, consider both of them when seeking for a proper method or property as in the following case.

The standard subscription APS type defines the resources operation that lists all resources of a specified subscription with the limitation and actual usage for every resource. To get this data from one of the listed above subscriptions, run a REST request similar to the following:

Request:

GET /aps/2/resources/d1d637c9-4b67-4045-be19-2f2f0f513288/resources

The response shows the list of resources with the limit, usage, and unit properties in each of them as in this example:

[
  {
    "id": "1000072",
    "title": "OCU - App REF",
    "apsId": "1b7adee2-3121-4639-adde-5a85a6866da1",
    "apsType": "http://aps-standard.org/samples/offer-counter-user/cloud/1.0",
    "usage": 1,
    "limit": 1,
    "unit": "unit"
  },
  {
    "id": "1000073",
    "title": "OCU - Silver config",
    "apsId": "65e1bb24-f4bb-4a48-9d7d-c8967aedc978",
    "apsType": "http://aps-standard.org/samples/offer-counter-user/offer/1.0",
    "usage": 1,
    "limit": 10,
    "unit": "unit"
  },
  {
    "id": "1000074",
    "title": "OCU - Gold config",
    "apsId": "aad24762-2b28-44ff-ae96-4284b7d28940",
    "apsType": "http://aps-standard.org/samples/offer-counter-user/offer/1.0",
    "usage": 1,
    "limit": 5,
    "unit": "unit"
  },
  {
    "id": "1000075",
    "title": "OCU - VPS management",
    "apsType": "http://aps-standard.org/samples/offer-counter-user/context/1.0",
    "usage": 1,
    "limit": 1,
    "autoprovisioning": true,
    "unit": "unit"
  },
  {
    "id": "1000076",
    "title": "OCU - VPS",
    "apsType": "http://aps-standard.org/samples/offer-counter-user/vps/1.0",
    "usage": 2,
    "unit": "unit"
  },
  {
    "id": "1000077",
    "title": "OCU - CPU cores",
    "apsType": "http://aps-standard.org/samples/offer-counter-user/context/1.0",
    "property": "cpuusagetotal",
    "usage": 32,
    "limit": 100,
    "unit": "unit"
  },
  {
    "id": "1000078",
    "title": "OCU - RAM space",
    "apsType": "http://aps-standard.org/samples/offer-counter-user/context/1.0",
    "property": "memoryusagetotal",
    "usage": 3555328,
    "limit": 104857600,
    "unit": "KB"
  },
  {
    "id": "1000079",
    "title": "OCU - Disk space",
    "apsType": "http://aps-standard.org/samples/offer-counter-user/context/1.0",
    "property": "diskusagetotal",
    "usage": 138412032,
    "limit": 1048576000,
    "unit": "KB"
  }
]