Повідомлення

Список всіх публично доступних методів для взаємодії з API.

GET

Отримувати повідомлення з розмови -/conversation/read/{type}/{id}

Метод запита

GEThttp://apilocal.stableproxy.com/v2/conversation/read/{type}/{id}

Параметри запиту

ІдентифікаторПравилаПриклад
searchНе обов'язковоnullablestring161
per-pageНе обов'язковоnullableinteger25
pageНе обов'язковоnullableinteger99
sort-byНе обов'язковоnullablestringapp\_validators\_ex_in_rule""
sort-orderНе обов'язковоnullablestringin:asc, desc"asc"
type1required""
id1required27

Приклади коду

async function getConversationRead() {
   const baseUrl = 'http://apilocal.stableproxy.com/v2';
   const req = await fetch(baseUrl + '/conversation/read/{type}/{id}'
      .replace("{type}", "")
      .replace("{id}", 27) + '?' + Object.entries({
         "search": 161,
         "per-page": 25,
         "page": 99,
         "sort-by": "",
         "sort-order": "asc"
      }).map(([key, value]) => key + "=" + value).join('&'), {
         method: 'GET',
         headers: {
            'Content-Type': 'application/json'
         }
      }
   );
   
   const res = await req.json();
}

Приклади відповідей

POST

Надіслати повідомлення -/conversation/send/{type}/{id}

Метод запита

POSThttp://apilocal.stableproxy.com/v2/conversation/send/{type}/{id}

Параметри запиту

ІдентифікаторПравилаПриклад
messageНе обов'язковоrequired_without:files1382
filesНе обов'язковоarraydistinct2
files..*requiredfiledistinct5652
type1required""
id1required91

Приклади коду

async function postConversationSend() {
   const baseUrl = 'http://apilocal.stableproxy.com/v2';
   const req = await fetch(baseUrl + '/conversation/send/{type}/{id}'
      .replace("{type}", "")
      .replace("{id}", 91), {
         method: 'POST',
         headers: {
            'Content-Type': 'application/json'
         },
         body: JSON.stringify({
            "message": 1382,
            "files": 2,
            "files..*": 5652
         }),
      }
   );
   
   const res = await req.json();
}

Приклади відповідей

PUT

Позначити повідомлення як прочитане -/conversation/read/{type}/{id}/{uid}

Метод запита

PUThttp://apilocal.stableproxy.com/v2/conversation/read/{type}/{id}/{uid}

Параметри запиту

ІдентифікаторПравилаПриклад
type1required""
id1required84
uid1required46

Приклади коду

async function putConversationRead() {
   const baseUrl = 'http://apilocal.stableproxy.com/v2';
   const req = await fetch(baseUrl + '/conversation/read/{type}/{id}/{uid}'
      .replace("{type}", "")
      .replace("{id}", 84)
      .replace("{uid}", 46), {
         method: 'PUT',
         headers: {
            'Content-Type': 'application/json'
         }
      }
   );
   
   const res = await req.json();
}

Приклади відповідей