Промокоды

Получение списка промокодов. Создание, изменение или удаление промокодов. Всё покажем с примерами на нашем сайте

Работа с промокодами

Получение списка промокодов

GET https://api.lpmotor.ru/v1/promo

This endpoint allows you to get free cakes.

Query Parameters

Headers

[
  {
    "id": 0,
    "code": "string",
    "pos": 0,
    "is_enabled": true,
    "bonus_type": 0,
    "bonus_amount": 0,
    "bonus_amount_is_in_percentages": true,
    "time_limit_is_enabled": true,
    "d_on": "2021-08-04T13:57:37.243Z",
    "d_off": "2021-08-04T13:57:37.243Z",
    "quantity_limit_is_enabled": true,
    "quantity_limit": 0,
    "promo_used_count": 0,
    "is_valid": true
  }
]

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

curl \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Api-User-Id: <<Your-user-id>>" \
-H "Authorization: Bearer <<Your-API-token>>" \
-X GET "https://api.lpmotor.ru/v1/promo?site_id=11111" 

Создание промокода

POST https://api.lpmotor.ru/v1/promo

Headers

Request Body

{
  "code": "string",
  "is_enabled": true,
  "bonus_type": 0,
  "bonus_amount": 0,
  "bonus_amount_is_in_percentages": true,
  "time_limit_is_enabled": true,
  "d_on": "2021-08-04T14:36:22.614Z",
  "d_off": "2021-08-04T14:36:22.614Z",
  "quantity_limit_is_enabled": true,
  "quantity_limit": 0,
  "personal_limit_is_enabled": true
}

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

curl \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Api-User-Id: <<Your-user-id>>" \
-H "Authorization: Bearer <<Your-API-token>>" \
-X POST "https://api.lpmotor.ru/v1/promo" \ 
-d '{"user_id":123,"site_id":11111,"code":"mypromocode"}'

Получение промокода по ID

GET https://api.lpmotor.ru/v1/promo/{promo_id}

Path Parameters

Headers

{
  "code": "string",
  "is_enabled": true,
  "bonus_type": 0,
  "bonus_amount": 0,
  "bonus_amount_is_in_percentages": true,
  "time_limit_is_enabled": true,
  "d_on": "2021-08-04T14:39:18.248Z",
  "d_off": "2021-08-04T14:39:18.248Z",
  "quantity_limit_is_enabled": true,
  "quantity_limit": 0,
  "personal_limit_is_enabled": true
}

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

curl \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Api-User-Id: <<Your-user-id>>" \
-H "Authorization: Bearer <<Your-API-token>>" \
-X GET "https://api.lpmotor.ru/v1/promo/1" 

Изменение промокода

PUT https://api.lpmotor.ru/v1/promo/{promo_id}

Path Parameters

Headers

Request Body

{
  "code": "string",
  "is_enabled": true,
  "bonus_type": 0,
  "bonus_amount": 0,
  "bonus_amount_is_in_percentages": true,
  "time_limit_is_enabled": true,
  "d_on": "2021-08-04T14:43:46.897Z",
  "d_off": "2021-08-04T14:43:46.897Z",
  "quantity_limit_is_enabled": true,
  "quantity_limit": 0,
  "personal_limit_is_enabled": true
}

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

curl \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Api-User-Id: <<Your-user-id>>" \
-H "Authorization: Bearer <<Your-API-token>>" \
-X PUT "https://api.lpmotor.ru/v1/promo/1" \ 
-d '{"code":"newpromocode"}'

Удаление промокода

DELETE https://api.lpmotor.ru/v1/promo/{promo_id}

Path Parameters

Headers

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

curl \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Api-User-Id: <<Your-user-id>>" \
-H "Authorization: Bearer <<Your-API-token>>" \
-X DELETE "https://api.lpmotor.ru/v1/promo/1" 

Получение статистики использования промокода

GET https://api.lpmotor.ru/v1/promo/{promo_id}/statistics

Path Parameters

Headers

[
  {
    "id": 0,
    "promo_id": 0,
    "lead_id": 0,
    "bonus_type_id": 0,
    "bonus_amount": 0,
    "bonus_amount_is_in_percentages": 0,
    "order_price": 0,
    "order_quantity": 0,
    "discount_amount": 0,
    "promo": {
      "code": "string"
    },
    "d_lead_created": "2021-08-04T15:02:13.184Z",
    "currency": "string"
  }
]

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

curl \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Api-User-Id: <<Your-user-id>>" \
-H "Authorization: Bearer <<Your-API-token>>" \
-X GET "https://api.lpmotor.ru/v1/promo/1/statistics"

Last updated