The Update subscription method is used to change the Auto-renew option of a subscription for the current reseller or any of its downstream resellers (see Auto-Renewing a subscription).
PATCH {{base_url}}/api/v3/resellers/{{reseller_id}}/subscriptions/{{subscription_id}}
Authentication
This endpoint requires a JWT access token. Specify the token in the Authorization header using the Bearer authentication scheme:
Authorization: Bearer <JWT_ACCESS_TOKEN>
In Postman, select Bearer Token on the Authorization tab and enter the JWT access token.
Arguments
|
Name |
Parameter Type |
Data type |
Required/Optional |
Description |
||
|---|---|---|---|---|---|---|
|
Content-Type |
header |
string |
Required |
Media type of the request. Specify the following: application/vnd.api+json |
||
|
Accept |
header |
string |
Required |
Supported media types of the answer. Specify the following: application/vnd.api+json |
||
|
base_url |
path |
string |
Required |
ActivePlatform URL |
||
|
reseller_id |
path |
integer |
Required |
ID of the current reseller or any of its downstream resellers (see Viewing and updating reseller general information) |
||
|
subscription_id |
path |
integer |
Required |
ID of the subscription |
||
|
data |
form |
object |
Required |
Information about the attributes of the operation |
||
|
|
attributes |
form |
object |
Required |
Attributes of the operation |
|
|
|
|
autorenew |
form |
bool |
Required |
Defines the target state of the Auto-renew option of the subscription:
|
Response model
If no errors are encountered, the method returns information about the subscription (see Get subscription).
Errors
|
Status |
Error text |
Comment |
|---|---|---|
|
403 |
This action is forbidden |
Check the list of available operations for the subscription (see Get subscription) |
|
422 |
You are trying to change the current Auto-renew value to the same value |
The target state of the Auto-renew option of the subscription is already set |
Request example
PATCH /api/v3/resellers/1/subscriptions/3007381
Host: test.activeplatform.com
Content-Type: application/vnd.api+json
Authorization: Bearer <JWT_ACCESS_TOKEN>
Accept: application/vnd.api+jsoni+json
JSON
{
"data": {
"attributes": {
"autorenew": true
}
}
}
Response example
{
"data": {
"id": "3007381",
"type": "subscriptions",
"attributes": {
"created_at": "2021-03-06T03:05:29.717+03:00",
"updated_at": "2021-03-06T04:44:10.185+03:00",
"plan_id": 5,
"account_id": 710,
"name": "Auto provisioning with resources",
"trial": false,
"status": "active",
"start_date": "2021-03-06",
"expiration_date": "2021-04-06",
"plan_period_id": 4,
"promo_code": "",
"payment_model": "postpay",
"payment_model_parameters": {
"credit_limit": 5000.0,
"current_debt": 123.89
},
"renewal_settings": {
"autorenew": true,
"disable_autorenew": false,
"autorenew_point": 0,
"manual_renew_point": -1
},
"fixed_price": false,
"ability": {
"stop": true,
"activate": false,
"destroy": true,
"adjust": true,
"switch_plan": false,
"renew": true,
"change_auto_renew_option": true,
"prolong": false,
"change_resources_renewal_order": false,
"decrease_resources_change_order": true,
"decrease_resources_prolong_order": true
},
"custom_price": false
},
"relationships": {
"account": {
"data": {
"id": "710",
"type": "accounts"
}
},
"subscription_resources": {
"data": [
{
"id": "35882",
"type": "subscription_resources"
},
{
"id": "35883",
"type": "subscription_resources"
},
{
"id": "35884",
"type": "subscription_resources"
}
]
},
"subscription_period": {
"data": {
"id": "6486",
"type": "subscription_periods"
}
},
"plan": {
"data": {
"id": "5",
"type": "plans"
}
}
}
}
}