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-TokenheaderstringRequiredAPI token of the Manager that performs the operation (see Viewing and updating manager's information)
Content-TypeheaderstringRequiredIndicates the media type (text/html or text/JSON) of the request that is sent to the server by the client (browser)
AcceptheaderstringRequired

Information about data types that the client (browser) supports

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_idformintegerRequired ID 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 the Reseller's Order Info by ID).

Errors

StatusError textComment
403This action is forbiddenCheck the list of available operations for the Subscription (see Get the Reseller's Subscription information by ID)
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 the Reseller's Plan information by ID)
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"
                    }
                ]
            }
        }
    }
}