update readme

This commit is contained in:
sergey 2024-10-10 14:08:45 +03:00
parent 972cad711e
commit d54cffe4a8
1 changed files with 27 additions and 6 deletions

View File

@ -5,11 +5,33 @@ swagger - https://osnova-api-alert.sm8255082.ru/docs
endpoints:
- https://osnova-api-alert.sm8255082.ru/ping (get, post)
без авторизации, без параметров
- https://osnova-api-alert.sm8255082.ru/api/v1/tg/send (post)
- https://osnova-api-alert.sm8255082.ru/api/v1/zbx/send-to-dashboard (post)
в заголовке должен быть токен 'x-api-key: токен'
должны предаваться в data problem_id:int, message:str
должны предаваться в data:
```json
{
"text": "string",
"subject": "string",
"problem_id": 0
}
```
- https://osnova-api-alert.sm8255082.ru/api/v1/zbx/send-to-net-chat (post)
в заголовке должен быть токен 'x-api-key: токен'
должны предаваться в data:
```json
{
"text": "string",
"subject": "string"
}
```
js для заббикса:
```js
```javascript
function sendMessage(value) {
var params = JSON.parse(value),
data,
@ -17,7 +39,7 @@ endpoints:
request = new HttpRequest(),
url = 'https://osnova-api-alert.sm8255082.ru/api/v1/tg/send';
request.addHeader('Content-Type: application/json');
request.addHeader('x-api-key: nz7cA1NKOwxwtiTZdbBDtLwopt2tOm7W');
request.addHeader('x-api-key: токен');
data = JSON.stringify(params);
response = request.post(url, data);
@ -43,7 +65,6 @@ endpoints:
catch (error) {
throw 'Unknown error ' + error;
}
```