Сообщения
Список всех доступных методов для взаимодействия с API.
GET
Получение сообщений из беседы -/conversation/read/{type}/{id}
Способ запроса
GEThttp://apilocal.stableproxy.com/v2/conversation/read/{type}/{id}
Параметры запроса
| Идентификатор | Правила | Пример |
|---|---|---|
| searchНе обязательно | nullablestring | 161 |
| per-pageНе обязательно | nullableinteger | 25 |
| pageНе обязательно | nullableinteger | 99 |
| sort-byНе обязательно | nullablestringapp\_validators\_ex_in_rule | "" |
| sort-orderНе обязательно | nullablestringin:asc, desc | "asc" |
| type | 1required | "" |
| id | 1required | 27 |
Примеры кода
JavaScript
1async function getConversationRead() {
2 const baseUrl = 'http://apilocal.stableproxy.com/v2';
3 const req = await fetch(baseUrl + '/conversation/read/{type}/{id}'
4 .replace("{type}", "")
5 .replace("{id}", 27) + '?' + Object.entries({
6 "search": 161,
7 "per-page": 25,
8 "page": 99,
9 "sort-by": "",
10 "sort-order": "asc"
11 }).map(([key, value]) => key + "=" + value).join('&'), {
12 method: 'GET',
13 headers: {
14 'Content-Type': 'application/json'
15 }
16 }
17 );
18
19 const res = await req.json();
20}Примеры ответов
Success response
POST
Отправить сообщение -/conversation/send/{type}/{id}
Способ запроса
POSThttp://apilocal.stableproxy.com/v2/conversation/send/{type}/{id}
Параметры запроса
| Идентификатор | Правила | Пример |
|---|---|---|
| messageНе обязательно | required_without:files | 1382 |
| filesНе обязательно | arraydistinct | 2 |
| files..* | requiredfiledistinct | 5652 |
| type | 1required | "" |
| id | 1required | 91 |
Примеры кода
JavaScript
1async function postConversationSend() {
2 const baseUrl = 'http://apilocal.stableproxy.com/v2';
3 const req = await fetch(baseUrl + '/conversation/send/{type}/{id}'
4 .replace("{type}", "")
5 .replace("{id}", 91), {
6 method: 'POST',
7 headers: {
8 'Content-Type': 'application/json'
9 },
10 body: JSON.stringify({
11 "message": 1382,
12 "files": 2,
13 "files..*": 5652
14 }),
15 }
16 );
17
18 const res = await req.json();
19}Примеры ответов
Success response
PUT
Пометить сообщение как прочитанное -/conversation/read/{type}/{id}/{uid}
Способ запроса
PUThttp://apilocal.stableproxy.com/v2/conversation/read/{type}/{id}/{uid}
Параметры запроса
| Идентификатор | Правила | Пример |
|---|---|---|
| type | 1required | "" |
| id | 1required | 84 |
| uid | 1required | 46 |
Примеры кода
JavaScript
1async function putConversationRead() {
2 const baseUrl = 'http://apilocal.stableproxy.com/v2';
3 const req = await fetch(baseUrl + '/conversation/read/{type}/{id}/{uid}'
4 .replace("{type}", "")
5 .replace("{id}", 84)
6 .replace("{uid}", 46), {
7 method: 'PUT',
8 headers: {
9 'Content-Type': 'application/json'
10 }
11 }
12 );
13
14 const res = await req.json();
15}