In the Account-Wide Subscription Services (AWS) mode (default mode), an application can operate subscriptions using its own code.
In this document:
An application can operate subscriptions through the following actions:
Get all information about subscriptions
Create resources in a selected subscription
Bind a user to the application services in a selected subscription
Before you start implementing those operations, get familiar with various ways of getting and specifying subscriptions.
In a UI view, an application can identify all subscriptions a customer has in order to specify the one to manage application resources in.
A resource JSON representation contains the parent subscription APS ID inside the aps
section.
For example, you declare a navigation variable as:
<var type-id="http://aps-standard.org/samples/basic1p/vps/1.0" name="vps" />
Then, inside the respective view code, you can identify the subscription APS ID:
var subscriptionId = aps.context.vars.vps.aps.subscription;
A REST request for provisioning a resource should contain the APS-Subscription-ID
header to specify
the subscription for resource provisioning. In the view source code, rather than assigning the proper value to this
header directly, assign the subscription ID to the aps.context.subscriptionId
property instead.
To use it in an aps/Store
data store, assign the property before you declare the store:
aps.context.subscriptionId = subscriptionId;
var store = new Store({
target: "/aps/2/resources"
});
Once this is done, the POST operations sent through the store will contain the APS-Subscription-ID
header
with the assigned subscription ID.
You can override the described above default behavior for a particular resource if you specify a subscription ID in the resource JSON representation sent for provisioning:
POST /aps/2/resources
{ "aps": {
"type": "<APS type ID>",
"subscription": "<subscrition APS ID>"
},
... // Other resource properties
}
In a UI wizard, an application can pass resource representation from a source view
to the destination view using
the aps.apsc.next
utility. You can specify explicitly a subscription ID in each of the resource representation
as follows:
aps.apsc.next({ resources: [
{ aps: {
type: <APS type ID>,
subscription: <subscription APS ID>
}
... // Other resource properties
},
...
]});
When sending a REST request with both APS-Subscription_ID
header and aps.subscription
property in
the resource JSON representation, the latter takes precedence.
When integrated with the Home Dashboard, the respective application view-plugin will get
the mediator.resourceUsage
array that contains resource usage data for all subscriptions of the customer.
The view-plugin can filter and sort resource usage by subscription IDs:
resourceUsage: {
"subscription APS ID": [
//resource usage in the format as returned by /aps/2/<subscription GUID>/resources
],
"<another subscription APS ID>": [...],
...
}