Symptoms

How do I get limits for resources available for end-user? Does POA prevent the provisioning of more resources when the user hits the limit? Do I have to handle the checking?

Resolution

APS controller will not allow to create more objects that are allowed by limits, but without proper handling the following error message will be shown to end-user on attempt to overuse the resource:

RequestError: Unable to load /aps/2/resources/587f8be5-4390-4d80-b760-69c6660af876/users/ status: 403 Creation of resource with type 'http://aps.com/app/user/1.0'; is not allowed.

You can draw UI items depending on limits and current usage, for example if you know that the object will not be able to be created you disable UI items that allow to create that.

To get the limits you have to get subscription resources

GET /aps/2/resources/fdf042f5-2808-4c24-b0f4-f1d3debefca5/resources

where fdf042f5-2808-4c24-b0f4-f1d3debefca5 is the id of resource of type http://aps-standard.org/types/core/subscription/1.0

[
    {
            "title": "Customer",
            "apsType": "http://application.com/customers/1.0",
            "id": 1000437,
            "usage": 1,
            "unit": "unit"
    },
    {
            "title": "Users",
            "apsType": "http://application.com/users/1.0",
            "id": 1000443,
            "usage": 1,
            "limit": 1,
            "unit": "unit"
    },
    {
            "title": "Application",
            "apsId": "8d6ac7b5-8cf2-4367-9c69-3c34e635326d",
            "apsType": "http://application.com/context/1.0",
            "id": 1000435,
            "usage": 0,
            "unit": "unit"
    }
]

Note: if limit for resource is set to 'unlimited' in subscription/serivce template/serivice plan 'limit' property is not returned at all.

See also how to get the subscription limit with PHP runtime in this KB article.

Internal content