Skip to content

Commit 3209697

Browse files
committed
Docs: Update API page.
1 parent e4b652c commit 3209697

2 files changed

Lines changed: 68 additions & 1 deletion

File tree

docs/api.md

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ There are several API endpoints:
77

88
- [`GET /`](#index): check if API is running (just returns `It works!` message)
99
- [`POST /datapoints`](#insert-datapoints): insert datapoints into DP³
10-
- [`GET /entity/<entity_type>`](#list-entities): list current snapshots of all entities of given type
10+
- ~~[`GET /entity/<entity_type>`](#list-entities): list current snapshots of all entities of given type~~
11+
- [`GET /entity/<entity_type>/get`](#get-entities): get current snapshots of entities of entity type
12+
- [`GET /entity/<entity_type>/count`](#count-entities): get total document count for query of entity type
1113
- [`GET /entity/<entity_type>/<entity_id>`](#get-eid-data): get data of entity with given entity id
1214
- [`GET /entity/<entity_type>/<entity_id>/get/<attr_id>`](#get-attr-value): get attribute value
1315
- [`GET /entity/<entity_type>/<entity_id>/set/<attr_id>`](#set-attr-value): set attribute value
@@ -198,8 +200,46 @@ v -> some_embedded_dict_field
198200

199201
## List entities
200202

203+
!!! warning "Deprecated"
204+
205+
This endpoint is deprecated and will be removed in the future,
206+
Use [`GET /entity/<entity_type>/get`](#get-entities) to get paged documents and
207+
[`GET /entity/<entity_type>/count`](#count-entities) to get total document count for query.
208+
201209
List latest snapshots of all ids present in database under entity type,
202210
filtered by `generic_filter` and `fulltext_filters`.
211+
Contains only the latest snapshot per entity.
212+
213+
Counts all results for given query.
214+
215+
### Request
216+
217+
`GET /entity/<entity_type>`
218+
219+
**Optional query parameters:**
220+
221+
- skip: how many entities to skip (default: 0)
222+
- limit: how many entities to return (default: 20)
223+
- fulltext_filters: dictionary of fulltext filters (default: no filters)
224+
- generic_filter: dictionary of generic filters (default: no filters)
225+
226+
### Response
227+
228+
```json
229+
{
230+
"time_created": "2023-07-04T12:10:38.827Z",
231+
"data": [
232+
{}
233+
]
234+
}
235+
```
236+
237+
---
238+
239+
## Get entities
240+
241+
Get a list of latest snapshots of all ids present in database under entity type,
242+
filtered by `generic_filter` and `fulltext_filters`.
203243
Contains only the latest snapshot per entity.
204244

205245
Uses pagination, default limit is 20, setting to 0 will return all results.
@@ -244,6 +284,31 @@ Generic and fulltext filters are merged - fulltext overrides conflicting keys.
244284

245285
---
246286

287+
## Count entities
288+
289+
Count latest snapshots of all ids present in database under entity type,
290+
filtered by `generic_filter` and `fulltext_filters`.
291+
See [`GET /entity/<entity_type>/get`](#get-entities) for details on filter format.
292+
293+
### Request
294+
295+
`GET /entity/<entity_type>/count`
296+
297+
**Optional query parameters:**
298+
299+
- fulltext_filters: dictionary of fulltext filters (default: no filters)
300+
- generic_filter: dictionary of generic filters (default: no filters)
301+
302+
### Response
303+
304+
```json
305+
{
306+
"total_count": 0
307+
}
308+
```
309+
310+
---
311+
247312
## Get Eid data
248313

249314
Get data of entity type's eid.

mkdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ markdown_extensions:
8282
# Additional attribute lists (used e.g. for image size)
8383
- attr_list
8484
- md_in_html
85+
# Strike-through
86+
- pymdownx.tilde
8587

8688
plugins:
8789
# Default search bar

0 commit comments

Comments
 (0)