123 lines
3.2 KiB
HTTP
123 lines
3.2 KiB
HTTP
### 1. Получение токена авторизации CDEK
|
||
POST {{base_url}}/v2/oauth/token
|
||
Content-Type: application/x-www-form-urlencoded
|
||
|
||
grant_type=client_credentials&client_id={{client_id}}&client_secret={{client_secret}}
|
||
|
||
> {%
|
||
client.global.set("auth_token", response.body.access_token);
|
||
%}
|
||
|
||
### 2. Получение информации о заказе по номеру СДЭК
|
||
GET {{base_url}}/v2/orders?cdek_number=10240410458
|
||
Authorization: Bearer {{auth_token}}
|
||
|
||
### 3. Инициализация оплаты доставки
|
||
POST http://localhost:8000/api/v1/delivery/order
|
||
Content-Type: application/json
|
||
|
||
{
|
||
"senderAddress": {
|
||
"cityId": 1,
|
||
"city": "Дубай",
|
||
"street": "Sheikh Zayed Road",
|
||
"house": "10",
|
||
"apartment": "201",
|
||
"zip": "12345",
|
||
"comment": "Домофон 12"
|
||
},
|
||
"senderContact": {
|
||
"fullName": "Петр Петров",
|
||
"email": "sender@example.com",
|
||
"phone": "+79009876543",
|
||
"phoneExt": null,
|
||
"isCompany": false,
|
||
"companyName": null,
|
||
"inn": null,
|
||
"kpp": null
|
||
},
|
||
"receiverAddress": {
|
||
"cityId": 2,
|
||
"city": "Шарджа",
|
||
"street": "Al Wahda",
|
||
"house": "5",
|
||
"apartment": null,
|
||
"zip": "54321",
|
||
"comment": null
|
||
},
|
||
"receiverContact": {
|
||
"fullName": "Иван Иванов",
|
||
"email": "ivan@example.com",
|
||
"phone": "+79001234567",
|
||
"phoneExt": "101",
|
||
"isCompany": false,
|
||
"companyName": null,
|
||
"inn": null,
|
||
"kpp": null
|
||
},
|
||
"content": {
|
||
"description": "Наушники"
|
||
},
|
||
"pickupDate": "2026-05-15T10:00:00.000Z",
|
||
"deliveryDate": "2026-05-18T18:00:00.000Z",
|
||
"accountEmail": "client@example.com",
|
||
"systemData": {
|
||
"tariff": {
|
||
"provider": "СДЭК",
|
||
"serviceName": "Экспресс лайт",
|
||
"price": 125000,
|
||
"deliveryDaysMin": 1,
|
||
"deliveryDaysMax": 2,
|
||
"tariffCode": 535
|
||
},
|
||
"parcelType": "parcel",
|
||
"docPackaging": null,
|
||
"weight": "1.0",
|
||
"dimensions": {
|
||
"length": "20",
|
||
"width": "15",
|
||
"height": "10"
|
||
}
|
||
}
|
||
}
|
||
|
||
> {%
|
||
client.global.set("payment_url", response.body.payment_url);
|
||
%}
|
||
|
||
### 5. Список доступных тарифов
|
||
GET {{base_url}}/v2/calculator/alltariffs
|
||
Authorization: Bearer {{auth_token}}
|
||
X-User-Lang: rus
|
||
|
||
### 6. Формирование накладной по заказу
|
||
POST {{base_url}}/v2/print/orders
|
||
Authorization: Bearer {{auth_token}}
|
||
Content-Type: application/json
|
||
|
||
{
|
||
"orders": [
|
||
{
|
||
"order_uuid": "abd93f2d-7c5a-4820-9fdd-cab39aadbb1f"
|
||
}
|
||
],
|
||
"copy_count": 1
|
||
}
|
||
|
||
### 7. Получение накладной по UUID
|
||
GET {{base_url}}/v2/print/orders/31ff53f5-4c01-43aa-afa2-b7efdf0c06da
|
||
Authorization: Bearer {{auth_token}}
|
||
|
||
### 8. Просмотр заказа CDEK по UUID (с related_entities)
|
||
GET {{base_url}}/v2/orders/1e2282ba-529e-4ee7-9d82-2d7837145755
|
||
Authorization: Bearer {{auth_token}}
|
||
|
||
### 9. Скачивание готовой квитанции (PDF)
|
||
# Подставь WAYBILL_UUID из related_entities[type=waybill] (### 8).
|
||
# Файл сохраняется рядом с http-client.http как waybill.pdf.
|
||
GET {{base_url}}/v2/print/orders/31ff53f5-4c01-43aa-afa2-b7efdf0c06da.pdf
|
||
Authorization: Bearer {{auth_token}}
|
||
Accept: application/pdf
|
||
|
||
>>! waybill.pdf
|