Introduction
Эта документация призвана предоставить всю информацию, необходимую для работы с нашим API.
Base URL
https://www.amapi.ru
Authenticating requests
To authenticate requests, include an Authorization
header with the value "Bearer your-token"
.
All authenticated endpoints are marked with a requires authentication
badge in the documentation below.
Для получения токена Вам необходимо авторизоваться методом api/login. При успешной авторизации система возвращает вновь созданный работающий токен.
Заказ
POST api/create-order
requires authentication
Создание заказа
Example request:
curl --request POST \
"https://www.amapi.ru/api/create-order" \
--header "Authorization: Bearer 1Dg4PfVhaEcve36Z56dk8ab" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"Иванов Иван Иванович\",
\"email\": \"[email protected]\",
\"phone\": \"+7 999 999-99-99\",
\"deliveryType\": \"address\",
\"deliveryCompany\": \"СДЭК\",
\"lgsTerminalId\": \"103\",
\"lgsCompanyId\": 304,
\"lgsTariffId\": 1502,
\"address\": {
\"city\": \"Москва\",
\"street\": \"Красная площадь\",
\"house\": \"3\",
\"latitude\": 55.76,
\"longitude\": 37.64,
\"kladr\": \"7700000000000\"
},
\"paymentOption\": 1,
\"desiredDeliveryDate\": 1626695813,
\"desiredDeliveryInterval\": \"с 12 до 18\",
\"deliveryIntervalCost\": 0,
\"totalDeliveryPrice\": 0,
\"summWithoutDelivery\": 0,
\"totalWeight\": 0.48,
\"totalVolume\": 0.00098,
\"items\": [
{
\"productId\": 1191767,
\"itemId\": 857,
\"name\": \"Смартфон Xiaomi Redmi Note 9 3\\/64Gb Green\",
\"price\": 12554,
\"quantity\": 1,
\"deliveryPrice\": 300,
\"status\": 12554
},
{
\"productId\": 1191767,
\"itemId\": 857,
\"name\": \"Смартфон Xiaomi Redmi Note 9 3\\/64Gb Green\",
\"price\": 12554,
\"quantity\": 1,
\"deliveryPrice\": 300,
\"status\": 12554
}
]
}"
const url = new URL(
"https://www.amapi.ru/api/create-order"
);
const headers = {
"Authorization": "Bearer 1Dg4PfVhaEcve36Z56dk8ab",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "Иванов Иван Иванович",
"email": "[email protected]",
"phone": "+7 999 999-99-99",
"deliveryType": "address",
"deliveryCompany": "СДЭК",
"lgsTerminalId": "103",
"lgsCompanyId": 304,
"lgsTariffId": 1502,
"address": {
"city": "Москва",
"street": "Красная площадь",
"house": "3",
"latitude": 55.76,
"longitude": 37.64,
"kladr": "7700000000000"
},
"paymentOption": 1,
"desiredDeliveryDate": 1626695813,
"desiredDeliveryInterval": "с 12 до 18",
"deliveryIntervalCost": 0,
"totalDeliveryPrice": 0,
"summWithoutDelivery": 0,
"totalWeight": 0.48,
"totalVolume": 0.00098,
"items": [
{
"productId": 1191767,
"itemId": 857,
"name": "Смартфон Xiaomi Redmi Note 9 3\/64Gb Green",
"price": 12554,
"quantity": 1,
"deliveryPrice": 300,
"status": 12554
},
{
"productId": 1191767,
"itemId": 857,
"name": "Смартфон Xiaomi Redmi Note 9 3\/64Gb Green",
"price": 12554,
"quantity": 1,
"deliveryPrice": 300,
"status": 12554
}
]
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://www.amapi.ru/api/create-order',
[
'headers' => [
'Authorization' => 'Bearer 1Dg4PfVhaEcve36Z56dk8ab',
'Accept' => 'application/json',
],
'json' => [
'name' => 'Иванов Иван Иванович',
'email' => '[email protected]',
'phone' => '+7 999 999-99-99',
'deliveryType' => 'address',
'deliveryCompany' => 'СДЭК',
'lgsTerminalId' => '103',
'lgsCompanyId' => 304.0,
'lgsTariffId' => 1502.0,
'address' => [
'city' => 'Москва',
'street' => 'Красная площадь',
'house' => '3',
'latitude' => 55.76,
'longitude' => 37.64,
'kladr' => '7700000000000',
],
'paymentOption' => 1,
'desiredDeliveryDate' => 1626695813,
'desiredDeliveryInterval' => 'с 12 до 18',
'deliveryIntervalCost' => 0.0,
'totalDeliveryPrice' => 0.0,
'summWithoutDelivery' => 0.0,
'totalWeight' => 0.48,
'totalVolume' => 0.00098,
'items' => [
[
'productId' => 1191767,
'itemId' => 857,
'name' => 'Смартфон Xiaomi Redmi Note 9 3/64Gb Green',
'price' => 12554.0,
'quantity' => 1,
'deliveryPrice' => 300.0,
'status' => 12554,
],
[
'productId' => 1191767,
'itemId' => 857,
'name' => 'Смартфон Xiaomi Redmi Note 9 3/64Gb Green',
'price' => 12554.0,
'quantity' => 1,
'deliveryPrice' => 300.0,
'status' => 12554,
],
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://www.amapi.ru/api/create-order'
payload = {
"name": "Иванов Иван Иванович",
"email": "[email protected]",
"phone": "+7 999 999-99-99",
"deliveryType": "address",
"deliveryCompany": "СДЭК",
"lgsTerminalId": "103",
"lgsCompanyId": 304,
"lgsTariffId": 1502,
"address": {
"city": "Москва",
"street": "Красная площадь",
"house": "3",
"latitude": 55.76,
"longitude": 37.64,
"kladr": "7700000000000"
},
"paymentOption": 1,
"desiredDeliveryDate": 1626695813,
"desiredDeliveryInterval": "с 12 до 18",
"deliveryIntervalCost": 0,
"totalDeliveryPrice": 0,
"summWithoutDelivery": 0,
"totalWeight": 0.48,
"totalVolume": 0.00098,
"items": [
{
"productId": 1191767,
"itemId": 857,
"name": "Смартфон Xiaomi Redmi Note 9 3\/64Gb Green",
"price": 12554,
"quantity": 1,
"deliveryPrice": 300,
"status": 12554
},
{
"productId": 1191767,
"itemId": 857,
"name": "Смартфон Xiaomi Redmi Note 9 3\/64Gb Green",
"price": 12554,
"quantity": 1,
"deliveryPrice": 300,
"status": 12554
}
]
}
headers = {
'Authorization': 'Bearer 1Dg4PfVhaEcve36Z56dk8ab',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (201):
{
"OrderCreated": true,
"OrderCode": "XX0000-00000"
}
Example response (400):
{
"signedIn": false,
"message": "Не создан заказ"
}
Received response:
Request failed with error:
Response
Response Fields
OrderCreated
boolean
Заказ создан
orderCode
string
Номер заказа
message
string
Сообщение об ошибке. При 2 или более ошибках передается в массиве
POST api/buy-click
requires authentication
Покупка товара в 1 клик
Example request:
curl --request POST \
"https://www.amapi.ru/api/buy-click" \
--header "Authorization: Bearer 6cZDfP6Vhaeagk31b5vdE84" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"phone\": \"+7 999 999-99-99\",
\"email\": \"[email protected]\",
\"name\": \"Иванов Иван Иванович\",
\"totalWeight\": 0.48,
\"totalVolume\": 0.00098,
\"items\": [
{
\"productId\": 1191767,
\"itemId\": 857,
\"name\": \"Смартфон Xiaomi Redmi Note 9 3\\/64Gb Green\",
\"price\": 12554,
\"quantity\": 1,
\"deliveryPrice\": 300,
\"status\": 12554
},
{
\"productId\": 1191767,
\"itemId\": 857,
\"name\": \"Смартфон Xiaomi Redmi Note 9 3\\/64Gb Green\",
\"price\": 12554,
\"quantity\": 1,
\"deliveryPrice\": 300,
\"status\": 12554
}
]
}"
const url = new URL(
"https://www.amapi.ru/api/buy-click"
);
const headers = {
"Authorization": "Bearer 6cZDfP6Vhaeagk31b5vdE84",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"phone": "+7 999 999-99-99",
"email": "[email protected]",
"name": "Иванов Иван Иванович",
"totalWeight": 0.48,
"totalVolume": 0.00098,
"items": [
{
"productId": 1191767,
"itemId": 857,
"name": "Смартфон Xiaomi Redmi Note 9 3\/64Gb Green",
"price": 12554,
"quantity": 1,
"deliveryPrice": 300,
"status": 12554
},
{
"productId": 1191767,
"itemId": 857,
"name": "Смартфон Xiaomi Redmi Note 9 3\/64Gb Green",
"price": 12554,
"quantity": 1,
"deliveryPrice": 300,
"status": 12554
}
]
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://www.amapi.ru/api/buy-click',
[
'headers' => [
'Authorization' => 'Bearer 6cZDfP6Vhaeagk31b5vdE84',
'Accept' => 'application/json',
],
'json' => [
'phone' => '+7 999 999-99-99',
'email' => '[email protected]',
'name' => 'Иванов Иван Иванович',
'totalWeight' => 0.48,
'totalVolume' => 0.00098,
'items' => [
[
'productId' => 1191767,
'itemId' => 857,
'name' => 'Смартфон Xiaomi Redmi Note 9 3/64Gb Green',
'price' => 12554.0,
'quantity' => 1,
'deliveryPrice' => 300.0,
'status' => 12554,
],
[
'productId' => 1191767,
'itemId' => 857,
'name' => 'Смартфон Xiaomi Redmi Note 9 3/64Gb Green',
'price' => 12554.0,
'quantity' => 1,
'deliveryPrice' => 300.0,
'status' => 12554,
],
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://www.amapi.ru/api/buy-click'
payload = {
"phone": "+7 999 999-99-99",
"email": "[email protected]",
"name": "Иванов Иван Иванович",
"totalWeight": 0.48,
"totalVolume": 0.00098,
"items": [
{
"productId": 1191767,
"itemId": 857,
"name": "Смартфон Xiaomi Redmi Note 9 3\/64Gb Green",
"price": 12554,
"quantity": 1,
"deliveryPrice": 300,
"status": 12554
},
{
"productId": 1191767,
"itemId": 857,
"name": "Смартфон Xiaomi Redmi Note 9 3\/64Gb Green",
"price": 12554,
"quantity": 1,
"deliveryPrice": 300,
"status": 12554
}
]
}
headers = {
'Authorization': 'Bearer 6cZDfP6Vhaeagk31b5vdE84',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (201):
{
"OrderCreated": true,
"OrderCode": "XX0000-00000"
}
Example response (400):
{
"signedIn": false,
"message": "Не создан заказ"
}
Received response:
Request failed with error:
Response
Response Fields
OrderCreated
boolean
Заказ создан
orderCode
string
Номер заказа
message
string
Сообщение об ошибке. При 2 или более ошибках передается в массиве
POST api/callback
requires authentication
Заказ обратного звонка
Example request:
curl --request POST \
"https://www.amapi.ru/api/callback" \
--header "Authorization: Bearer DEbh8veakgfPZ5cVd613a46" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"phone\": \"+7 999 999-99-99\",
\"name\": \"Иванов Иван Иванович\"
}"
const url = new URL(
"https://www.amapi.ru/api/callback"
);
const headers = {
"Authorization": "Bearer DEbh8veakgfPZ5cVd613a46",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"phone": "+7 999 999-99-99",
"name": "Иванов Иван Иванович"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://www.amapi.ru/api/callback',
[
'headers' => [
'Authorization' => 'Bearer DEbh8veakgfPZ5cVd613a46',
'Accept' => 'application/json',
],
'json' => [
'phone' => '+7 999 999-99-99',
'name' => 'Иванов Иван Иванович',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://www.amapi.ru/api/callback'
payload = {
"phone": "+7 999 999-99-99",
"name": "Иванов Иван Иванович"
}
headers = {
'Authorization': 'Bearer DEbh8veakgfPZ5cVd613a46',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (201):
{
"OrderCreated": true,
"OrderCode": "XX0000-00000"
}
Example response (400):
{
"signedIn": false,
"message": "Не создан заказ"
}
Received response:
Request failed with error:
Response
Response Fields
OrderCreated
boolean
Заказ создан
orderCode
string
Номер заказа
message
string
Сообщение об ошибке. При 2 или более ошибках передается в массиве
Личный кабинет
POST api/register
Регистрация нового пользователя и его авторизация
Example request:
curl --request POST \
"https://www.amapi.ru/api/register" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"Ваше имя\",
\"email\": \"Ваша электронная почта\",
\"password\": \"Ваш пароль\",
\"password_confirmation\": \"Ваш пароль\"
}"
const url = new URL(
"https://www.amapi.ru/api/register"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "Ваше имя",
"email": "Ваша электронная почта",
"password": "Ваш пароль",
"password_confirmation": "Ваш пароль"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://www.amapi.ru/api/register',
[
'headers' => [
'Accept' => 'application/json',
],
'json' => [
'name' => 'Ваше имя',
'email' => 'Ваша электронная почта',
'password' => 'Ваш пароль',
'password_confirmation' => 'Ваш пароль',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://www.amapi.ru/api/register'
payload = {
"name": "Ваше имя",
"email": "Ваша электронная почта",
"password": "Ваш пароль",
"password_confirmation": "Ваш пароль"
}
headers = {
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (201):
{
"signedUp": true,
"token": "2|8xUSKeX9YfnaaxvzPSsMG6uCGoJE3MHVEbdf0Ibn"
}
Example response (400):
{
"signedUp": false,
"message": "Ошибка при регистрации"
}
Received response:
Request failed with error:
Response
Response Fields
signedUp
boolean
Регистрация успешная или нет
token
string
Вновь созданный токен
message
string
Сообщение об ошибке
POST api/login
Авторизация пользователя и получение токена
Example request:
curl --request POST \
"https://www.amapi.ru/api/login" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"email\": \"Ваша электронная почта\",
\"password\": \"Ваш пароль\"
}"
const url = new URL(
"https://www.amapi.ru/api/login"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"email": "Ваша электронная почта",
"password": "Ваш пароль"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://www.amapi.ru/api/login',
[
'headers' => [
'Accept' => 'application/json',
],
'json' => [
'email' => 'Ваша электронная почта',
'password' => 'Ваш пароль',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://www.amapi.ru/api/login'
payload = {
"email": "Ваша электронная почта",
"password": "Ваш пароль"
}
headers = {
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (201):
{
"signedIn": true,
"token": "2|8xUSKeX9YfnaaxvzPSsMG6uCGoJE3MHVEbdf0Ibn"
}
Example response (400):
{
"signedIn": false,
"message": "Неправильный логин (электронная почта) и\/или пароль."
}
Received response:
Request failed with error:
Response
Response Fields
signedIn
boolean
Авторизация успешная или нет
token
string
Вновь созданный токен
message
string
Сообщение об ошибке
POST api/logout
requires authentication
выход из системы и аннулирование токенов
Example request:
curl --request POST \
"https://www.amapi.ru/api/logout" \
--header "Authorization: Bearer 8d6caPgVkh1fE4Z6D5bva3e" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://www.amapi.ru/api/logout"
);
const headers = {
"Authorization": "Bearer 8d6caPgVkh1fE4Z6D5bva3e",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://www.amapi.ru/api/logout',
[
'headers' => [
'Authorization' => 'Bearer 8d6caPgVkh1fE4Z6D5bva3e',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://www.amapi.ru/api/logout'
headers = {
'Authorization': 'Bearer 8d6caPgVkh1fE4Z6D5bva3e',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers)
response.json()
Example response (200):
{
"signedOut": true
}
Example response (400):
{
"message": "Unauthenticated"
}
Received response:
Request failed with error:
Response
Response Fields
signedOut
boolean
Выход из системы и аннулирование токенов
message
string
Сообщение об ошибке
POST api/change-password
requires authentication
Смена пароля пользователя
Example request:
curl --request POST \
"https://www.amapi.ru/api/change-password" \
--header "Authorization: Bearer D3468kcvbdZa5gPea1V6hfE" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"email\": \"Ваша электронная почта\",
\"old_password\": \"Ваш пароль\",
\"password\": \"Ваш пароль\",
\"password_confirmation\": \"Ваш пароль\"
}"
const url = new URL(
"https://www.amapi.ru/api/change-password"
);
const headers = {
"Authorization": "Bearer D3468kcvbdZa5gPea1V6hfE",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"email": "Ваша электронная почта",
"old_password": "Ваш пароль",
"password": "Ваш пароль",
"password_confirmation": "Ваш пароль"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://www.amapi.ru/api/change-password',
[
'headers' => [
'Authorization' => 'Bearer D3468kcvbdZa5gPea1V6hfE',
'Accept' => 'application/json',
],
'json' => [
'email' => 'Ваша электронная почта',
'old_password' => 'Ваш пароль',
'password' => 'Ваш пароль',
'password_confirmation' => 'Ваш пароль',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://www.amapi.ru/api/change-password'
payload = {
"email": "Ваша электронная почта",
"old_password": "Ваш пароль",
"password": "Ваш пароль",
"password_confirmation": "Ваш пароль"
}
headers = {
'Authorization': 'Bearer D3468kcvbdZa5gPea1V6hfE',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (201):
{
"passwordChanged": true,
"token": "2|8xUSKeX9YfnaaxvzPSsMG6uCGoJE3MHVEbdf0Ibn"
}
Example response (400):
{
"passwordChanged": false,
"message": "Ошибка при регистрации"
}
Received response:
Request failed with error:
Response
Response Fields
passwordChanged
boolean
Регистрация успешная или нет
token
string
Вновь созданный токен
message
string
Сообщение об ошибке
Проверка
GET api/test
Проверка доступности сервиса
Example request:
curl --request GET \
--get "https://www.amapi.ru/api/test" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://www.amapi.ru/api/test"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://www.amapi.ru/api/test',
[
'headers' => [
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://www.amapi.ru/api/test'
headers = {
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"isAuthenticated": true,
"serviceAvailable": true
}
Received response:
Request failed with error:
Response
Response Fields
isAuthenticated
boolean
Пользователь авторизован
serviceAvailable
boolean
Сервиса доступен
onlineRegistrationAvailable
boolean
Онлайн-регистрация доступна