-
-
Notifications
You must be signed in to change notification settings - Fork 3
Заметки
redboo edited this page Jan 29, 2022
·
17 revisions
Получить заметку из данной базы.
GET /note/:id
| Attribute | Type | Required | Description |
|---|---|---|---|
id |
string | yes | ID (название) заметки в формате URL-encoded |
source |
string | no | Название базы |
curl --header "https://githab.example.com/api/v4/note/home?source=db_name"Пример ответа:
{
"content" : "home page",
"source" : "db_name",
"title" : "home"
}
Создает новую заметку в базе с заданным заголовком и содержимым.
POST /note/add
| Attribute | Type | Required | Description |
|---|---|---|---|
title |
string | yes | URL-кодированая (уникальная) строка, например, page%2Fname
|
content |
string | yes | Содержимое заметки |
source |
string | no | Название базы |
curl --data "source=db_name&title=Hello&content=Hello world" \ --header "https://githab.example.com/api/v4/note/add"
Пример ответа:
{
"content" : "Hello world",
"source" : "db_name",
"title" : "Hello"
}
Поиск заметок в базе.
GET /note/search/:query
| Attribute | Type | Required | Description |
|---|---|---|---|
query |
string | required | URL-кодированая (уникальная) строка, например, page%2Fname
|
search-by |
string | no | Поиск по полям. Доступные значения: all (default), title, content
|
operator |
string | no | Логический оператор поиска по полям. Доступные значения: or (default), and
|
limit |
integer | no | Количество результатов на странице. По умолчанию - 10, максимум - 100
|
offset |
integer | no | Смещение результатов. По умолчанию - 0
|
fields |
string | no | Возвращаемые поля, перечисляются без пробелов, через запятую. Доступные значения: title (default), content, all
|
source |
string | no | Название базы |
curl --header "https://githab.example.com/api/v4/note/search/query?source=db_name&search-by=title"Пример ответа:
{
"results": [
{
"content" : "query page",
"source" : "db_name",
"title" : "query"
}
],
"count": 0,
"path": "http://github.com/TVP-Support/knowledge/tree/main/db/"
}