The Create change order method is used to a change order for increasing or decreasing the resources quantity of a subscription for the current reseller or any of its downstream resellers. The standard logic of the platform is used (see Upgrading or downgrading subscription resources).
POST {{base_url}}/api/v3/resellers/{{reseller_id}}/change_order
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) |
||||
|
data |
form |
object |
Required |
Information about the attributes of the operation |
||||
|
|
attributes |
form |
object |
Required |
Attributes of the operation |
|||
|
|
|
subscription_id |
form |
integer |
Required |
ID of the subscription |
||
|
|
|
resources |
form |
object |
Optional |
List of the subscription resources in the order |
||
|
|
|
|
data |
form |
array |
Optional |
Information about a subscription resource |
|
|
|
|
|
|
resource_id |
form |
integer |
Optional |
ID of the subscription resource |
|
|
|
|
|
additional |
form |
integer |
Optional |
Additional quantity of the subscription resource above the quantity included in the plan (see Plan Resources). The new resource quantity will be validated as follows:
|
|
|
|
promo_code |
form |
string |
Optional |
Promo-code for a discount |
||
Response model
If no errors are encountered, the method returns data as the information about the created order (see the response model in Get order). Status: 201 Created.
Errors
|
Status |
Error text |
Comment |
|---|---|---|
|
403 |
This action is forbidden |
Check the list of available operations for the subscription (see Get subscription) |
|
422 |
Resources downgrade are not allowed |
|
|
There are ordered invalid amount of resources |
The total quantity of a resource with the additional quantity should fit the range defined in the plan (see Get plan) |
|
|
Order could not be created: resource change {resource ID} is not available. You can change up to {available quantity} |
The new resource quantity appeared less than {available quantity} — the minimum resource quantity that should remain in the subscription, according to information received from the vendor. To create the order, it is necessary to increase |
|
|
Order could not be created: resource change {resource ID} is not available |
The new resource quantity appeared less than the minimum resource quantity that should remain in the subscription, but the vendor did not specified the exact value. To create the order, it is necessary to increase |
|
|
The order cannot be completed: the order total has exceeded the credit limit for this subscription |
To create the order, it is necessary to increase the credit limit of the account (see Viewing and updating account's details) or individual credit limit of the subscription (see Viewing and updating subscription's details) |
|
|
The resource id is not available for ordering in plan |
The resource is not available in the current plan |
|
|
To change the quantity of resource id, specify a value other than already ordered |
The order has the quantity of the resource equal to the current quantity. Specify the changed quantity of the resource |
|
|
Order for the selected account is not available due to restrictions imposed on the account or reseller |
The validation service (see Managing the validation service) determined that restrictions are imposed on the reseller or account. Creating an order is not available for the product linked to the specified subscription (see Get subscription) |
|
|
Order for the selected service is not available. service for checking the restrictions imposed on the account or reseller is not available. Please try to place order later |
The validation service (see Managing the validation service) failed to check the reseller and account. To create an order, try again later or contact the support team |
|
|
The account or reseller does not have the INN attribute |
To create an order, create and specify the INN attribute for the reseller or account (see Managing attributes) and then try again |
Request example
POST /api/v3/resellers/1/change_order
Host: test.activeplatform.com
Content-Type: application/vnd.api+json
Authorization: Bearer <JWT_ACCESS_TOKEN>
Accept: application/vnd.api+json
JSON
{
"data": {
"attributes": {
"subscription_id": 3007514,
"resources": {
"data": [
{
"subscription_resource_id": 36229,
"additional": 1
}
]
},
"promo_code": ""
}
}
}
Response example
{
"data": {
"id": "11708",
"type": "change_orders",
"attributes": {
"created_at": "2020-11-06T09:03:42.130+03:00",
"updated_at": "2020-11-06T09:03:42.498+03:00",
"document_id": "CO001248",
"status": "completed",
"account_id": 710,
"type": "ChangeOrder",
"closed_at": "2020-11-06T09:03:42.498+03:00",
"expiration_date": "2020-12-05",
"provisioning_date": null,
"total": "58.02",
"promo_code": "",
"payment_id": null,
"manager_id": 225,
"requester_ip": null,
"custom_price": false,
"created_by": "#225 Adam Manager",
"subscription_id": 3007514,
"items": [
{
"id": 20058,
"target_id": 49964,
"target_type": "SubscriptionResource",
"type": "ProvisioningItem::Upgrade",
"status": "completed",
"description": "HDD",
"quantity": 1,
"resource_id": 152581
}
]
},
"relationships": {
"charges": {
"data": [
{
"id": "311752",
"type": "charges"
}
]
}
}
}
}