Subscription APIs
These APIs are used to perform the following tasks:
Fetching List of Azure Subscriptions from CCKM
Use the get /v1/cckm/azure/subscriptions API to retrieve the list of Azure subscriptions from CCKM. The results can be filtered using the query parameters.
Syntax
curl -k '<IP>/api/v1/cckm/azure/subscriptions?skip=0&limit=10' -H 'Authorization: Bearer AUTHTOKEN' --compressed
Request Parameter
| Parameter | Type | Description | 
|---|---|---|
| AUTHTOKEN | string | Authorization token. | 
Request Query Parameters
| Parameter | Type | Description | 
|---|---|---|
| id | string | ID of the subscription. | 
| skip | integer | Number of records to skip. For example, if "skip":5is specified, the first five records will not be displayed in the output. | 
| limit | integer | Numbers of records to display. For example, if "limit":10is specified, then the next 10 records (after skipping the number of records specified in theskipparameter ) will be displayed in the output. | 
Example Request
curl -k 'https://127.0.0.1/api/v1/cckm/azure/subscriptions?skip=0&limit=10' -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiI1MDIzNTY1Yy0xOWI3LTQyY2UtODZmMi1jNWI3
MTA1MTJhZjMiLCJzdWIiOiJsb2NhbHwwMWI4M2EwZS1mY2U1LTQ5MjgtODhiNi0zNTNkMmQ3ZTBiNDMiLCJpc
3MiOiJreWxvIiwiYWNjIjoia3lsbyIsInByZWZlcnJlZF91c2VybmFtZSI6ImFkbWluIiwiY3VzdCI6eyJkb2
1haW5faWQiOiIwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDAiLCJncm91cHMiOlsiYWRtaW4
iXSwic2lkIjoiZGJlNzU2MWYtZDVhOS00ZGEzLWJiZTEtNjlhMTg0Y2U3YzEzIiwiem9uZV9pZCI6IjAwMDAw
MDAwLTAwMDAtMDAwMC0wMDAwLTAwMDAwMDAwMDAwMCJ9LCJqd3RpZCI6ImFmYmI2ODAwLTQ3NjctNDNkMi04O
GFhLTNhMzI5MGE0MGQ5YSIsImlhdCI6MTYwMTQ2MDU0NywiZXhwIjoxNjAxNDYwODQ3fQ.R_
3FQyH9EgaWQckWCBkOgrpqy3tRbuIV2nfozvZYZIU' --compressed
Example Response
{
    "skip": 0,
    "limit": 10,
    "total": 1,
    "resources": [
        {
            "id": "484f861a-81cc-4d5a-b92d-61bbcfe3fd96",
            "uri": "kylo:kylo:cckm:subscription:484f861a-81cc-4d5a-b92d-
            61bbcfe3fd96",
            "account": "kylo:kylo:admin:accounts:kylo",
            "application": "ncryptify:gemalto:admin:apps:kylo",
            "devAccount": "ncryptify:gemalto:admin:accounts:gemalto",
            "createdAt": "2020-09-30T09:59:12.026994Z",
            "updatedAt": "2020-09-30T09:59:12.024346Z",
            "subscriptionId": "12e533dd-b5c2-4e58-a264-0cd812dc5a34",
            "subscriptionUri": "/subscriptions/12e533dd-b5c2-4e58-a264-
            0cd812dc5a34",
            "displayName": "Pay-As-You-Go",
            "state": "Enabled",
            "subscriptionPolicies": {
                "quotaId": "PayAsYouGo_2014-09-01",
                "spendingLimit": "Off",
                "locationPlacementId": "Public_2014-09-01"
                },
            "authorizationSource": "RoleBased"
        }
    ]
}
The sample output displays the list of the Azure subscription available on CCKM.
Response Codes
| Response Code | Description | 
|---|---|
| 2xx | Success | 
| 4xx | Client errors | 
| 5xx | Server errors | 
Refer to HTTP status codes for details.
Retrieving List of Subscriptions from Azure
Use the post /v1/cckm/azure/get-subscriptions API to get the list of subscriptions from Azure based on the connection.
Syntax
curl -k '<IP>/api/v1/cckm/azure/get-subscriptions' -H 'Authorization: Bearer AUTHTOKEN' -H 'Content-Type: application/json' --data-binary $'{\n "connection": "<connection_identifier>"\n}' --compressed
Request Parameters
| Parameter | Type | Description | 
|---|---|---|
| AUTHTOKEN | string | Authorization token. | 
| connection | string | Name or ID of the connection based on which subscriptions are fetched. | 
Example Request
curl -k 'https://127.0.0.1/api/v1/cckm/azure/get-subscriptions' -H 'Authorization:
Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiI1MDIzNTY1Yy0xOWI3LTQyY2UtODZmMi1jNWI3
MTA1MTJhZjMiLCJzdWIiOiJsb2NhbHwwMWI4M2EwZS1mY2U1LTQ5MjgtODhiNi0zNTNkMmQ3ZTBiNDMiLCJpc
3MiOiJreWxvIiwiYWNjIjoia3lsbyIsInByZWZlcnJlZF91c2VybmFtZSI6ImFkbWluIiwiY3VzdCI6eyJkb2
1haW5faWQiOiIwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDAiLCJncm91cHMiOlsiYWRtaW4
iXSwic2lkIjoiZGJlNzU2MWYtZDVhOS00ZGEzLWJiZTEtNjlhMTg0Y2U3YzEzIiwiem9uZV9pZCI6IjAwMDAw
MDAwLTAwMDAtMDAwMC0wMDAwLTAwMDAwMDAwMDAwMCJ9LCJqd3RpZCI6ImVmN2NmYTY1LTk3ZWMtNDcyYi05M
ThmLWEzZmQxNGYyNjgwMSIsImlhdCI6MTYwMTQ1OTY2MCwiZXhwIjoxNjAxNDU5OTYwfQ.WjSNmAcUCua4uT4
IzE8sTZWXsGLfMGPr4hput9kDphQ' -H 'Content-Type: application/json' --data-binary $'{\n
"connection": "azure-connection"\n}' --compressed
Example Response
[
    {
        "id": "/subscriptions/12e533dd-b5c2-4e58-a264-0cd812dc5a34",
        "subscriptionId": "12e533dd-b5c2-4e58-a264-0cd812dc5a34",
        "displayName": "Pay-As-You-Go",
        "state": "Enabled",
        "subscriptionPolicies": {
        "locationPlacementId": "Public_2014-09-01",
        "quotaId": "PayAsYouGo_2014-09-01",
        "spendingLimit": "Off"
        },
        "authorizationSource": "RoleBased"
    }
]
The sample output displays the list of subscription from Azure based on the connection (azure-connection).
Response Codes
| Response Code | Description | 
|---|---|
| 2xx | Success | 
| 4xx | Client errors | 
| 5xx | Server errors | 
Refer to HTTP status codes for details.
Viewing Details of Azure Subscriptions
Use the get /v1/cckm/azure/subscriptions/{id} API to view the details of a particular subscription.
Syntax
curl -k '<IP>/api/v1/cckm/azure/subscriptions/{id}' -H 'Authorization: Bearer AUTHTOKEN' --compressed
Here, {id} represents the subscription ID.
Request Parameter
| Parameter | Type | Description | 
|---|---|---|
| AUTHTOKEN | string | Authorization token. | 
Example Request
curl -k 'https://127.0.0.1/api/v1/cckm/azure/subscriptions/484f861a-81cc-4d5a-b92d-
61bbcfe3fd96' -H 'Authorization: Bearer
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJiOGNhMTQ4OS0zZGVhLTQyZjUtYTM4My02YWMy
OTVmOGUwOWYiLCJzdWIiOiJsb2NhbHw2MTgzMTFhOS1jNzU1LTQ5YjgtOWEyMS0wN2ExYzIzZmI2NGMiLCJpc
3MiOiJreWxvIiwiYWNjIjoia3lsbyIsInByZWZlcnJlZF91c2VybmFtZSI6ImFkbWluIiwiY3VzdCI6eyJkb2
1haW5faWQiOiIwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDAiLCJncm91cHMiOlsiYWRtaW4
iXSwic2lkIjoiNjk1MjdhZWItMmY5OC00MzQyLTljODQtNDMxZWUzMmMwY2I0Iiwiem9uZV9pZCI6IjAwMDAw
MDAwLTAwMDAtMDAwMC0wMDAwLTAwMDAwMDAwMDAwMCJ9LCJqd3RpZCI6IjZjZDQ3NjhhLTk0ZDQtNGY5ZC1iN
mIyLWM5MDFhZTBiZmEwYSIsImlhdCI6MTYwMjQ5ODI4NiwiZXhwIjoxNjAyNDk4NTg2fQ.-
ZrqcBh54S7aWpAaBC608kKG9j6IF5D9YBjx6XGylq4' --compressed
Example Response
{
    "id": "484f861a-81cc-4d5a-b92d-61bbcfe3fd96",
    "uri": "kylo:kylo:cckm:subscription:484f861a-81cc-4d5a-b92d-61bbcfe3fd96",
    "account": "kylo:kylo:admin:accounts:kylo",
    "application": "ncryptify:gemalto:admin:apps:kylo",
    "devAccount": "ncryptify:gemalto:admin:accounts:gemalto",
    "createdAt": "2020-09-30T09:59:12.026994Z",
    "updatedAt": "2020-09-30T09:59:12.024346Z",
    "subscriptionId": "12e533dd-b5c2-4e58-a264-0cd812dc5a34",
    "subscriptionUri": "/subscriptions/12e533dd-b5c2-4e58-a264-0cd812dc5a34",
    "displayName": "Pay-As-You-Go",
    "state": "Enabled",
    "subscriptionPolicies": {
        "quotaId": "PayAsYouGo_2014-09-01",
        "spendingLimit": "Off",
        "locationPlacementId": "Public_2014-09-01"
        },
    "authorizationSource": "RoleBased"
}
The sample output shows the details corresponding to the subscription ID (484f861a-81cc-4d5a-b92d-61bbcfe3fd96).
Response Codes
| Response Code | Description | 
|---|---|
| 2xx | Success | 
| 4xx | Client errors | 
| 5xx | Server errors | 
Refer to HTTP status codes for details.