Activate subscription for an object

Note that some of the features that can be controlled via the API are related to the permissions assigned to your access token (seller, customer etc. with subcategories). Please contact Skyresponse support if any Forbidden responses occur.

Activate a subscription for an object with a specific ID in Skyresponse Admin

In order to activate a subscription for an object, you will need a SubscriptionId.

Step 1: Fetch available subscriptions

Start by fetching the object’s CustomerId using the procedure described in fetch specific object. This will give you the CustomerId value for this object. Then use the CustomerId value in the url to get a list of subscriptions available for the customer owning the object.

GET /api/customers/{id}/subscriptions HTTP/1.1
Host: https://admin.skyresponse.com
Authorization: Bearer tkgY9yiM...plBp

If you don’t know how to get the Authorization header, please proceed to the Authentication tutorial.

The server will respond with a list of available subscriptions for the customer:

[
  {
    "SubscriptionId": 301,
    "SubscriptionGroupId": 181,
    "SubscriptionGroupDescription": "Admiral Demo LC",
    "SubscriptionPeriod": 12
  },
  {
    "SubscriptionId": 445,
    "SubscriptionGroupId": 309,
    "SubscriptionGroupDescription": "Alandia Demo LC",
    "SubscriptionPeriod": 12
  }
]

Where the SubscriptionId value is used when activating the subscription.


Step 2: Activate the subscription for the object

To activate the subscription for the object you should send a request to /users/{id}/activate including the desired SubscriptionID and where id is the specific object that shall be activated.

POST /api/users/{id}/activate HTTP/1.1
Host: https://admin.skyresponse.com
Authorization: Bearer tkgY9yiM...plBp

{
  "SubscriptionId": "301"
}

If SubscriptionId is correct and the object does not have an activated subscription you should recieve an HTTP 202 Accepted status code.

{
  "data": {
    "userId": 1,
    "userName": "Skyresponse Demo"
  },
  "errors": []
}

If the object already has a subscription, the server will respond with status code 406 Not Acceptable and body:

{
  "data": null,
  "errors": [
    {
      "name": "SubscriptionNotAllowedWhenUserActive",
      "description": "Subscription are not allowed to be set for active users"
    }
  ]
}

cURL example:

Example of activate subscription for an object:

curl -X POST -H "Content-Type: application/json" 'https://admin.skyresponse.com/api/users/1/activate' -H "Authorization: Bearer PASTE_YOUR_TOKEN_HERE" -d '{"SubscriptionId":"301"}'


Full documentation:
Topics:

Activate subscription for an object

Note that some of the features that can be controlled via the API are related to the permissions assigned to your access token (seller, customer etc. with subcategories). Please contact Skyresponse support if any Forbidden responses occur.

Activate a subscription for an object with a specific ID in Skyresponse Admin

In order to activate a subscription for an object, you will need a SubscriptionId.

Step 1: Fetch available subscriptions

Start by fetching the object’s CustomerId using the procedure described in fetch specific object. This will give you the CustomerId value for this object. Then use the CustomerId value in the url to get a list of subscriptions available for the customer owning the object.

GET /api/customers/{id}/subscriptions HTTP/1.1
Host: https://admin.skyresponse.com
Authorization: Bearer tkgY9yiM...plBp

If you don’t know how to get the Authorization header, please proceed to the Authentication tutorial.

The server will respond with a list of available subscriptions for the customer:

[
  {
    "SubscriptionId": 301,
    "SubscriptionGroupId": 181,
    "SubscriptionGroupDescription": "Admiral Demo LC",
    "SubscriptionPeriod": 12
  },
  {
    "SubscriptionId": 445,
    "SubscriptionGroupId": 309,
    "SubscriptionGroupDescription": "Alandia Demo LC",
    "SubscriptionPeriod": 12
  }
]

Where the SubscriptionId value is used when activating the subscription.


Step 2: Activate the subscription for the object

To activate the subscription for the object you should send a request to /users/{id}/activate including the desired SubscriptionID and where id is the specific object that shall be activated.

POST /api/users/{id}/activate HTTP/1.1
Host: https://admin.skyresponse.com
Authorization: Bearer tkgY9yiM...plBp

{
  "SubscriptionId": "301"
}

If SubscriptionId is correct and the object does not have an activated subscription you should recieve an HTTP 202 Accepted status code.

{
  "data": {
    "userId": 1,
    "userName": "Skyresponse Demo"
  },
  "errors": []
}

If the object already has a subscription, the server will respond with status code 406 Not Acceptable and body:

{
  "data": null,
  "errors": [
    {
      "name": "SubscriptionNotAllowedWhenUserActive",
      "description": "Subscription are not allowed to be set for active users"
    }
  ]
}

cURL example:

Example of activate subscription for an object:

curl -X POST -H "Content-Type: application/json" 'https://admin.skyresponse.com/api/users/1/activate' -H "Authorization: Bearer PASTE_YOUR_TOKEN_HERE" -d '{"SubscriptionId":"301"}'


Full documentation: