Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
polydb:rest:intro [2020/03/31 08:58] – created paffenholz | polydb:rest:intro [2023/03/24 21:55] (current) – paffenholz | ||
---|---|---|---|
Line 5: | Line 5: | ||
Base path: | Base path: | ||
< | < | ||
- | https:// | + | https:// |
</ | </ | ||
- | ==== Obtain info on available | + | The API implements the following endpoints: |
+ | * Info on collections | ||
+ | * section | ||
+ | * sections | ||
+ | * collection | ||
+ | * collections | ||
+ | * Schema | ||
+ | * schema | ||
+ | * Querying the Database | ||
+ | * find | ||
+ | * find_one | ||
+ | * count | ||
+ | * distinct | ||
+ | * id | ||
- | === Section === | + | Some examples are below. |
- | Section Documentation | + | The full documentation of all endpoints with examples for data and code **[[https:// |
+ | |||
+ | ==== Some examples for the REST API ==== | ||
+ | |||
+ | === Obtain info on available collections === | ||
+ | |||
+ | == section == | ||
+ | |||
+ | This returns section documentation | ||
< | < | ||
- | / | + | https:// |
</ | </ | ||
with possible parameters < | with possible parameters < | ||
< | < | ||
- | / | + | https:// |
</ | </ | ||
returns | returns | ||
Line 45: | Line 66: | ||
</ | </ | ||
- | === sections | + | == sections == |
- | === collection === | + | This returns a list of subsections of the given one |
+ | == collection == | ||
+ | |||
+ | This prints full information on a collection. The collection is given as | ||
+ | < | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Here is an example: | ||
< | < | ||
- | / | + | https:// |
</ | </ | ||
- | === collections | + | == collections == |
+ | This lists all collections contained in a section. | ||
< | < | ||
- | /collections/Tropical/ | + | /section/< |
</ | </ | ||
- | ==== Query Data ==== | + | Example: |
+ | < | ||
+ | https:// | ||
+ | </ | ||
+ | returns | ||
+ | < | ||
+ | [ | ||
- | === find === | + | " |
+ | " | ||
+ | " | ||
+ | " | ||
- | Example | + | ] |
+ | </ | ||
+ | |||
+ | === Query Data === | ||
+ | |||
+ | == find == | ||
+ | |||
+ | This endpoint does a general query on the given collection and returns a list of the results. You can set the options sort, limit, and skip. However, the query never returns more than 10 entries. | ||
+ | |||
+ | Example: | ||
< | < | ||
- | / | + | https:// |
</ | </ | ||
+ | will return at most 10 reflexive polytopes with 5 vertices, skipping the first 100 matches. | ||
- | === find_one | + | == find_one == |
- | Example | + | This works as find, but returns at most one match. The option limit does not apply here. |
+ | |||
+ | Example: | ||
< | < | ||
- | / | + | https:// |
</ | </ | ||
+ | |||
+ | == distinct == | ||
- | === distinct | + | == count == |
+ | |||
+ | This counts the number of results that match a given query. Example: | ||
+ | < | ||
+ | https:// | ||
+ | </ | ||
+ | returns | ||
+ | < | ||
+ | 139983 | ||
+ | </ | ||
+ | |||
+ | == id == | ||
+ | |||
+ | Returns a single document by its id. | ||
+ | |||
+ | Example | ||
+ | < | ||
+ | https:// | ||
+ | </ | ||
- | === count === | ||
- | ==== Obtain the JSON Schema for the data ==== | + | === Obtain the JSON Schema for the data === |
- | === schema | + | == schema == |
Example | Example | ||
< | < | ||
- | / | + | https:// |
</ | </ | ||