Вступление
Эта документация предназначена для предоставления всей информации, необходимой для работы с нашим API.
Base URL
https://neiros.cloud
Аутентификация запросов
Для проверки подлинности запросов включите заголовок авторизации со значением "Bearer {YOUR_AUTH_KEY}".
Все аутентифицированные конечные точки отмечены значком требует аутентификации в приведенной ниже документации.
API ключ выдается после авторизации методом пост по этому URL /api/userapi/v1/auth/login.
1.0.Авторизация
Авторизация
Example request:
curl --request POST \
"https://neiros.cloud/api/userapi/v1/auth/login" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"email\": \"test@test.ru\",
\"password\": \"123456\"
}"
const url = new URL(
"https://neiros.cloud/api/userapi/v1/auth/login"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"email": "test@test.ru",
"password": "123456"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"user": {
"name": "Тест",
"email": "test@test.ru",
"id": 176
},
"token": "323|RvUxhGGOpHatTfGvoIuTSXV9AmF6CqX3GMhpc5EH"
}
Received response:
Request failed with error:
1.1.Данные
Получение сделок по проекту
Заголовок Authorization Bearer TOKEN
При успешном ответе получаем
Example request:
curl --request GET \
--get "https://neiros.cloud/api/userapi/v1/projects?site_id=100&date_start=2020-01-01&date_end=2023-01-01&page=1" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "Authorization: Bearer 323|RvUxhGGOpHatTfGvoIuTSXV9AmF6CqX3GMhpc5EH" \
--data "{
\"site_id\": 13,
\"date_start\": \"2022-01-27T21:33:08\",
\"date_end\": \"2022-01-27T21:33:08\",
\"page\": 1
}"
const url = new URL(
"https://neiros.cloud/api/userapi/v1/projects"
);
const params = {
"site_id": "100",
"date_start": "2020-01-01",
"date_end": "2023-01-01",
"page": "1",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Bearer 323|RvUxhGGOpHatTfGvoIuTSXV9AmF6CqX3GMhpc5EH",
};
let body = {
"site_id": 13,
"date_start": "2022-01-27T21:33:08",
"date_end": "2022-01-27T21:33:08",
"page": 1
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"data": {
"projects": [
{
"id": 1, //ID сделки
"site_id": 100, //ID сайтай
"date": "2020-07-19" //Дата сделки
}
]
},
"last_page": 1,//Текущая страница
"total": 1 //Всего страниц
}
Received response:
Request failed with error:
Получение данных по конкретной сделке
Заголовок Authorization Bearer TOKEN
Example request:
curl --request GET \
--get "https://neiros.cloud/api/userapi/v1/project/8?site_id=100" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "Authorization: Bearer 323|RvUxhGGOpHatTfGvoIuTSXV9AmF6CqX3GMhpc5EH"const url = new URL(
"https://neiros.cloud/api/userapi/v1/project/8"
);
const params = {
"site_id": "100",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Bearer 323|RvUxhGGOpHatTfGvoIuTSXV9AmF6CqX3GMhpc5EH",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200):
{
"data": {
"id": 1,
"neiros_visit": "5f1363cc9eafb805ea197733",//Индификатор сессии
"neiros_id": "4602617",//Индификатор клиента
"created_at": "2020-07-18T21:04:48.000000Z",//Дата и время создания сделки
"phone": "79999999999",//Телефон
"duration": 15, //Время разговора
"record": "https:\/\/audio.neiros.ru\/b039d5a70ebd08d5b6b7508e34e3fe221.mp3",//Ссылка на запись
"canal": "Google",//Канал
"traffic": "google",//Источник трафика
"summ": 0,//Сумма сделки
"status": "Неразобранное"// Этап сделки
}
}
Received response:
Request failed with error:
Получение списка проектов Заголовок Authorization Bearer TOKEN
Example request:
curl --request GET \
--get "https://neiros.cloud/api/userapi/v1/sites" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "Authorization: Bearer 324|n8IDQc9GVMud0qU7jsgQIfvatoeo9Pey8ETStHvj"const url = new URL(
"https://neiros.cloud/api/userapi/v1/sites"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Bearer 324|n8IDQc9GVMud0qU7jsgQIfvatoeo9Pey8ETStHvj",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200):
{
"data": [
{
"name": "wistis.ru",
"id": 19
},
{
"name": "autokovrik.ru",
"id": 53
},
{
"name": "yandex.ru",
"id": 167
},
{
"name": "plugin.wistis.ru",
"id": 174
}
]
}
Received response:
Request failed with error:
Добавление суммы в сделку
Заголовок Authorization Bearer TOKEN
При успешном ответе получаем
Example request:
curl --request POST \
"https://neiros.cloud/api/userapi/v1/project/100/update" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "Authorization: Bearer 323|RvUxhGGOpHatTfGvoIuTSXV9AmF6CqX3GMhpc5EH" \
--data "{
\"site_id\": 100,
\"summ\": 1500
}"
const url = new URL(
"https://neiros.cloud/api/userapi/v1/project/100/update"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Bearer 323|RvUxhGGOpHatTfGvoIuTSXV9AmF6CqX3GMhpc5EH",
};
let body = {
"site_id": 100,
"summ": 1500
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"success": true
}
Received response:
Request failed with error: