Обновление информации о подписке

Метод используется для обновления следующей информации о подписке аккаунта, к которому есть доступ у текущего пользователя (кроме подписок в статусе Удалена):

  • Состояние опции Автопродление.

  • Название подписки.

PATCH {reseller_domain}/internal_api/accounts/{account_id}/subscriptions/{subscription_id}

В этой статье:

Авторизация

Требуется авторизация с помощью access token пользователя.

Аргументы

Название

Тип параметра

Тип данных

Обязательный/ 
Опциональный

Описание

Content-Type

header

string

Обязательный

Тип данных, передаваемых в запросе. Укажите application/vnd.api+json

Accept

header

string

Обязательный

Поддерживаемые типы данных в ответе. Укажите application/vnd.api+json

X-Api-Locale

header

string

Опциональный

Двухбуквенный код языка данных в ответе

Authorization 

header

string

Обязательный

Действующий access token пользователя. Формат: Bearer <access token>

reseller_domain

path

string

Обязательный

Доменное имя реселлера

account_id

path

integer

Обязательный

ID аккаунта, которому принадлежит подписка

subscription_id

path

integer

Обязательный

ID подписки

auto_renewal

form

bool

Опциональный

Целевое состояние опции Автопродление:

  • true — включена.

  • false — выключена.

name

form

string

Опциональный

Новое название подписки

Модель ответа

Модель ответа соответствует методу Получение информации о подписке.

Пример запроса

Bash
curl --location --request PATCH 'https://test.activeplatform.com/internal_api/accounts/1938/subscriptions/3010784' \
--header 'Content-Type: application/vnd.api+json' \
--header 'Accept: application/vnd.api+json' \
--header 'X-Api-Locale: en' \
--header 'Authorization: Bearer AccessTokenExample' \
--data-raw '{
    "data": {
        "attributes": {
            "auto_renewal": true
        }
    }
}'

Пример ответа

JSON
{
    "data": {
        "id": "3010784",
        "type": "subscriptions",
        "attributes": {
            "product_id": 2100,
            "created_at": "2023-01-24T13:08:12.334691+0300",
            "start_date": "2023-01-24T00:00:00.000000+0000",
            "name": "Office Monthly",
            "status": "active",
            "trial": false,
            "payment_model": "prepay",
            "expiration_date": "2024-01-24",
            "paid_to_date": "2023-02-01",
            "billing_type": "csp_monthly",
            "fixed_price": false,
            "custom_price": false,
            "auto_renewal": true,
            "renew_type": "plan_price",
            "plan_period_data": {
                "id": 10579,
                "duration_value": 1,
                "duration_type": "year",
                "endless": false
            },
            "plan_class_data": {
                "billing_day": 1,
                "deletion_client_period": -1
            },
            "unpaid_payments": {
                "unpaid_sum": 0,
                "payments": []
            },
            "subscription_credit_limit": 0,
            "reseller_currency_iso_code": "USD",
            "current_debt": 3.61,
            "product_category_data": {
                "id": 1306,
                "name": "Office",
                "color": "red"
            },
            "next_charges_info": {
                "charge_list": [
                    {
                        "text": "$45.98 <span>(for the duration of the service with 02.02.2023 by 28.02.2023)</span>",
                        "summa": 45.98,
                        "start_date": "2023-02-02"
                    }
                ]
            },
            "plan_id": 5851,
            "subscription_period_fees": {
                "setup_fee": 0,
                "recurring_fee": 0,
                "renewal_fee": 0,
                "transfer_fee": 0
            },
            "incomplete_orders": [],
            "entry_point": {
                "url": "/plugin_manual_provisioning/accounts/{account-id}/applications/{application-id}/info_page",
                "icon_url": "https://storage.test.activeplatform.com/public/images/entry_points/2205/Cloud.png"
            },
            "additional_params": [],
            "resources": [
                {
                    "id": 120396,
                    "resource_id": 44659,
                    "name": "Licenses",
                    "setup_fee": 0,
                    "recurring_fee": 45.98,
                    "renewal_fee": 0,
                    "overuse_fee": 0,
                    "included": 0,
                    "used": 0,
                    "additional": 1,
                    "limit": 0,
                    "minimum": 0,
                    "priority": 0,
                    "unlimited_units": true,
                    "unit_of_measure": "unit",
                    "plan_currency_iso_code": "USD",
                    "plan_resource_id": 23047
                }
            ],
            "available_operations": {
                "activate": false,
                "stop": true,
                "destroy": true,
                "prolong": true,
                "increase_resources_prolong_order": true,
                "decrease_resources_prolong_order": true,
                "renew": false,
                "increase_resources_renewal_order": true,
                "decrease_resources_renewal_order": true,
                "change": true,
                "increase_resources_change_order": true,
                "decrease_resources_change_order": true,
                "delayed_switch_plan_order": false,
                "immediate_switch_plan_order": false,
                "auto_renew": true,
                "auto_renewal_disabled": false,
                "set_budget": false
            },
            "spending_budget": null,
            "next_billing_date": "2023-03-01",
            "deletion_date": null,
            "taxes_calculation_settings": {
                "tax_is_calculated_using": "net_prices",
                "taxes": []
            }
        }
    },
    "meta": {
        "server_current_time": "2023-06-30 T12:34:56.199973+0300"
    }
}