Create a Prolong Order
The Create a Prolong Order method is used to create a Prolong Order for a Subscription for the current Reseller or any of its downstream Resellers. The standard logic of the platform is used (see Prolonging a subscription).
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}/prolong_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 to prolong | ||||
resources | form | object | Optional | List of Resources in the Order. If absent, the Subscription will be prolonged with the current amount of Resources | ||||
data | form | array | Optional | Information about Resources which amount is to be changed | ||||
plan_resource_id | form | integer | Optional | ID of the Plan Resource | ||||
quantity | form | integer | Optional | Target amount of the Plan Resource | ||||
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). Status: 201 Created.
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 | 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) |
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 Resource id is not available for ordering in plan | The Resource is not available in the current Plan |
Request example
POST /api/v3/resellers/1/prolong_order
Host: test.activeplatform.com
Content-Type: application/vnd.api+json
X-Api-Token: vY5fwetestK3gJXZH5uHCw
Accept: application/vnd.api+json
{
"data": {
"attributes": {
"subscription_id": 3008945,
"resources": {
"data": [
{
"plan_resource_id": 4340,
"quantity": 5
}
]
},
"promo_code": ""
}
}
}
Response example
{
"data": {
"id": "16106",
"type": "prolong_orders",
"attributes": {
"created_at": "2021-12-27T01:23:02.982+03:00",
"updated_at": "2021-12-27T01:23:03.128+03:00",
"document_id": "PO0000818",
"status": "waiting_for_payment",
"account_id": 1405,
"type": "ProlongOrder",
"closed_at": null,
"expiration_date": "2022-02-01",
"provisioning_date": null,
"total": "500.0",
"promo_code": null,
"payment_id": 11373,
"manager_id": 343,
"requester_ip": null,
"custom_price": false,
"created_by": "#343 Alexandr Sales",
"subscription_id": 3008945,
"items": [
{
"id": 23743,
"target_id": "Subscription",
"target_type": "Subscription",
"type": "ProvisioningItem::Prolong",
"status": "waiting_for_payment",
"description": "csp_monthly",
"quantity": "2022-01-01"
}
]
},
"relationships": {
"charges": {
"data": [
{
"id": "115181",
"type": "charges"
}
]
}
}
}
}