Create a Change Order
The Create a Change Order method is used to create a Change Order for 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).
Access to the current Reseller and downstream Resellers is determined by the Manager's token in the API request.
POST {base_url}/api/v3/resellers/{reseller_id}/change_order
Arguments
Name | Parameter Type | Data type | Required/Optional | Description | ||||
---|---|---|---|---|---|---|---|---|
X-Api-Token | header | string | Required | API token of the Manager that performs the operation (see Viewing and updating manager's information) | ||||
Content-Type | header | string | Required | Indicates the media type (text/html or text/JSON) of the request that is sent to the server by the client (browser) | ||||
Accept | header | string | Required | Information about data types that the client (browser) supports | ||||
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 amount of the Subscription Resource above the amount included in the Plan (see Plan Resources) | ||||
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 the Reseller's Order Info by ID).
Errors
Status | Error text | Comment |
---|---|---|
403 | This action is forbidden | Check the list of available operations for the Subscription (see Get the Reseller's Subscription information by ID) |
422 | Resources downgrade are not allowed | |
There are ordered invalid amount of resources | The total amount of a Resource with the additional amount should fit the range defined in the Plan (see Get the Reseller's Plan information by ID) | |
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 amount of the Resource equal to the current amount. Specify the changed amount of the Resource |
Request example
POST /api/v3/resellers/1/change_order
Host: test.activeplatform.com
Content-Type: application/vnd.api+json
X-Api-Token: vY5fwetestK3gJXZH5uHCw
Accept: application/vnd.api+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": "SubscriptionResource",
"target_type": "SubscriptionResource",
"type": "ProvisioningItem::Upgrade",
"status": "completed",
"description": "HDD",
"quantity": 1
}
]
},
"relationships": {
"charges": {
"data": [
{
"id": "311752",
"type": "charges"
}
]
}
}
}
}