Create change order

The Create change order method is used to a change order for increasing or decreasing the resources amount 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).

An API token of a manager is required for authorization. To get an API token via the Operator Control Panel, see Viewing and updating manager's information

The manager's API token specified in an API request determines the current reseller and downstream resellers accessible within a method.

POST {base_url}/api/v3/resellers/{reseller_id}/change_order

Arguments

Name

Parameter Type

Data type

Required/Optional

Description

X-Api-TokenheaderstringRequiredAPI token of a manager that performs the operation (see Viewing and updating manager's information)
Content-TypeheaderstringRequiredMedia type of the request. Specify the following: application/vnd.api+json
AcceptheaderstringRequired

Supported media types of the answer. Specify the following: application/vnd.api+json

base_urlpathstringRequiredActivePlatform URL
reseller_idpathintegerRequiredID of the current reseller or any of its downstream resellers (see Viewing and updating reseller general information)
dataformobjectRequiredInformation about the attributes of the operation

attributesformobjectRequiredAttributes of the operation


subscription_idformintegerRequiredID of the subscription 


resourcesformobjectOptionalList of the subscription resources in the order



dataformarrayOptionalInformation about a subscription resource




resource_idformintegerOptionalID of the subscription resource




additionalformintegerOptionalAdditional amount of the subscription resource above the amount included in the plan (see Plan Resources)


promo_codeformstringOptionalPromo-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

StatusError textComment
403This action is forbiddenCheck the list of available operations for the subscription (see Get subscription)
422Resources downgrade are not allowed
There are ordered invalid amount of resourcesThe total amount of a resource with the additional amount should fit the range defined in the plan (see Get plan)
The order cannot be completed: the order total has exceeded the credit limit for this subscriptionTo 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 planThe resource is not available in the current plan
To change the quantity of resource id, specify a value other than already orderedThe 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"
                    }
                ]
            }
        }
    }
}