2016-04-09 08:59:40 +02:00
|
|
|
`szurubooru` uses REST API for all operations.
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-13 13:33:03 +02:00
|
|
|
# Table of contents
|
2016-04-09 08:59:40 +02:00
|
|
|
|
|
|
|
1. [General rules](#general-rules)
|
|
|
|
|
|
|
|
- [Authentication](#authentication)
|
|
|
|
- [Basic requests](#basic-requests)
|
|
|
|
- [File uploads](#file-uploads)
|
|
|
|
- [Error handling](#error-handling)
|
|
|
|
|
|
|
|
2. [API reference](#api-reference)
|
|
|
|
|
2016-04-19 00:18:35 +02:00
|
|
|
- Tag categories
|
2016-04-19 15:45:12 +02:00
|
|
|
- [Listing tag categories](#listing-tag-categories)
|
2016-04-19 00:18:35 +02:00
|
|
|
- [Creating tag category](#creating-tag-category)
|
|
|
|
- [Updating tag category](#updating-tag-category)
|
|
|
|
- [Getting tag category](#getting-tag-category)
|
|
|
|
- [Deleting tag category](#deleting-tag-category)
|
|
|
|
- Tags
|
|
|
|
- [Listing tags](#listing-tags)
|
|
|
|
- [Creating tag](#creating-tag)
|
|
|
|
- [Updating tag](#updating-tag)
|
|
|
|
- [Getting tag](#getting-tag)
|
|
|
|
- [Deleting tag](#deleting-tag)
|
2016-04-20 19:02:39 +02:00
|
|
|
- [Merging tags](#merging-tags)
|
2016-04-20 21:31:46 +02:00
|
|
|
- [Listing tag siblings](#listing-tag-siblings)
|
2016-04-22 20:58:04 +02:00
|
|
|
- Posts
|
|
|
|
- ~~Listing posts~~
|
|
|
|
- ~~Creating post~~
|
|
|
|
- ~~Updating post~~
|
|
|
|
- ~~Getting post~~
|
|
|
|
- ~~Deleting post~~
|
2016-04-24 16:34:06 +02:00
|
|
|
- [Rating post](#rating-post)
|
2016-04-24 09:50:11 +02:00
|
|
|
- ~~Adding post to favorites~~
|
|
|
|
- ~~Removing post from favorites~~
|
2016-04-23 08:07:21 +02:00
|
|
|
- [Getting featured post](#getting-featured-post)
|
2016-04-22 20:58:04 +02:00
|
|
|
- [Featuring post](#featuring-post)
|
2016-04-24 09:50:11 +02:00
|
|
|
- Comments
|
2016-04-24 11:24:52 +02:00
|
|
|
- [Listing comments](#listing-comments)
|
2016-04-24 09:50:11 +02:00
|
|
|
- [Creating comment](#creating-comment)
|
2016-04-24 10:13:22 +02:00
|
|
|
- [Updating comment](#updating-comment)
|
2016-04-24 11:22:18 +02:00
|
|
|
- [Getting comment](#getting-comment)
|
2016-04-24 11:15:03 +02:00
|
|
|
- [Deleting comment](#deleting-comment)
|
2016-04-24 16:34:06 +02:00
|
|
|
- [Rating comment](#rating-comment)
|
2016-04-19 00:18:35 +02:00
|
|
|
- Users
|
|
|
|
- [Listing users](#listing-users)
|
|
|
|
- [Creating user](#creating-user)
|
|
|
|
- [Updating user](#updating-user)
|
|
|
|
- [Getting user](#getting-user)
|
|
|
|
- [Deleting user](#deleting-user)
|
|
|
|
- Password reset
|
|
|
|
- [Password reset - step 1: mail request](#password-reset---step-2-confirmation)
|
|
|
|
- [Password reset - step 2: confirmation](#password-reset---step-2-confirmation)
|
2016-04-21 19:25:38 +02:00
|
|
|
- Snapshots
|
|
|
|
- [Listing snapshots](#listing-snapshots)
|
2016-04-23 08:07:21 +02:00
|
|
|
- Global info
|
|
|
|
- [Getting global info](#getting-global-info)
|
2016-04-09 08:59:40 +02:00
|
|
|
|
|
|
|
3. [Resources](#resources)
|
|
|
|
|
|
|
|
- [User](#user)
|
2016-04-21 18:59:44 +02:00
|
|
|
- [Tag category](#tag-category)
|
2016-04-15 23:02:30 +02:00
|
|
|
- [Tag](#tag)
|
2016-04-22 20:58:04 +02:00
|
|
|
- [Post](#post)
|
2016-04-24 09:50:11 +02:00
|
|
|
- [Comment](#comment)
|
2016-04-21 18:59:44 +02:00
|
|
|
- [Snapshot](#snapshot)
|
2016-04-09 08:59:40 +02:00
|
|
|
|
|
|
|
4. [Search](#search)
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-13 13:33:03 +02:00
|
|
|
# General rules
|
2016-04-09 08:59:40 +02:00
|
|
|
|
2016-04-13 13:33:03 +02:00
|
|
|
## Authentication
|
2016-04-09 08:59:40 +02:00
|
|
|
|
|
|
|
Authentication is achieved by means of [basic HTTP
|
|
|
|
auth](https://en.wikipedia.org/wiki/Basic_access_authentication). For this
|
|
|
|
reason, it is recommended to connect through HTTPS. There are no sessions, so
|
|
|
|
every privileged request must be authenticated. Available privileges depend on
|
|
|
|
the user's rank. The way how rank translates to privileges is defined in the
|
|
|
|
server's configuration.
|
|
|
|
|
|
|
|
It is recommended to add `?bump-login` GET parameter to the first request in a
|
|
|
|
client "session" (where the definition of a session is up to the client), so
|
|
|
|
that the user's last login time is kept up to date.
|
|
|
|
|
2016-04-13 13:33:03 +02:00
|
|
|
## Basic requests
|
2016-04-09 08:59:40 +02:00
|
|
|
|
|
|
|
Every request must use `Content-Type: application/json` and `Accept:
|
|
|
|
application/json`. An exception to this rule are requests that upload files.
|
|
|
|
|
2016-04-13 13:33:03 +02:00
|
|
|
## File uploads
|
2016-04-09 08:59:40 +02:00
|
|
|
|
|
|
|
Requests that upload files must use `multipart/form-data` encoding. JSON
|
|
|
|
metadata must then be included as field of name `metadata`, whereas files must
|
|
|
|
be included as separate fields with names specific to each request type.
|
|
|
|
|
2016-04-13 13:33:03 +02:00
|
|
|
## Error handling
|
2016-04-09 08:59:40 +02:00
|
|
|
|
|
|
|
All errors (except for unhandled fatal server errors) send relevant HTTP status
|
|
|
|
code together with JSON of following structure:
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"title": "Generic title of error message, e.g. 'Not found'",
|
|
|
|
"description": "Detailed description of what went wrong, e.g. 'User `rr-` not found."
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-13 13:33:03 +02:00
|
|
|
# API reference
|
2016-04-09 08:59:40 +02:00
|
|
|
|
|
|
|
Depending on the deployment, the URLs might be relative to some base path such
|
2016-04-13 13:33:03 +02:00
|
|
|
as `/api/`. Values denoted with diamond braces (`<like this>`) signify variable
|
2016-04-09 08:59:40 +02:00
|
|
|
data.
|
|
|
|
|
|
|
|
|
2016-04-19 00:18:35 +02:00
|
|
|
## Listing tag categories
|
2016-04-19 11:56:09 +02:00
|
|
|
- **Request**
|
|
|
|
|
|
|
|
`GET /tag-categories`
|
|
|
|
|
|
|
|
- **Output**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"tagCategories": [
|
|
|
|
<tag-category>,
|
|
|
|
<tag-category>,
|
|
|
|
<tag-category>
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
...where `<tag-category>` is a [tag category resource](#tag-category).
|
|
|
|
|
|
|
|
- **Errors**
|
2016-04-19 00:18:35 +02:00
|
|
|
|
2016-04-19 11:56:09 +02:00
|
|
|
- privileges are too low
|
|
|
|
|
|
|
|
- **Description**
|
|
|
|
|
2016-04-20 21:31:46 +02:00
|
|
|
Lists all tag categories. Doesn't use paging.
|
2016-04-19 00:18:35 +02:00
|
|
|
|
2016-04-19 15:45:12 +02:00
|
|
|
**Note**: independently, the server exports current tag category list
|
|
|
|
snapshots to the data directory under `tags.json` name. Its purpose is to
|
|
|
|
reduce the trips frontend needs to make when doing autocompletion, and ease
|
|
|
|
caching. The data directory and its URL are controlled with `data_dir` and
|
|
|
|
`data_url` variables in server's configuration.
|
|
|
|
|
2016-04-19 00:18:35 +02:00
|
|
|
|
|
|
|
## Creating tag category
|
2016-04-19 11:56:09 +02:00
|
|
|
- **Request**
|
2016-04-19 00:18:35 +02:00
|
|
|
|
2016-04-19 11:56:09 +02:00
|
|
|
`POST /tag-categories`
|
|
|
|
|
|
|
|
- **Input**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"name": <name>,
|
|
|
|
"color": <color>
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
- **Output**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
2016-04-20 11:15:36 +02:00
|
|
|
"tagCategory": <tag-category>,
|
|
|
|
"snapshots": [
|
2016-04-21 18:59:44 +02:00
|
|
|
<snapshot>,
|
|
|
|
<snapshot>,
|
|
|
|
<snapshot>
|
2016-04-20 11:15:36 +02:00
|
|
|
]
|
2016-04-19 11:56:09 +02:00
|
|
|
}
|
|
|
|
```
|
2016-04-20 11:15:36 +02:00
|
|
|
...where `<tag-category>` is a [tag category resource](#tag-category), and
|
|
|
|
`snapshots` contain its earlier versions.
|
2016-04-19 11:56:09 +02:00
|
|
|
|
|
|
|
- **Errors**
|
|
|
|
|
|
|
|
- the name is used by an existing tag category (names are case insensitive)
|
|
|
|
- the name is invalid or missing
|
|
|
|
- the color is invalid or missing
|
|
|
|
- privileges are too low
|
|
|
|
|
|
|
|
- **Description**
|
|
|
|
|
|
|
|
Creates a new tag category using specified parameters. Name must match
|
|
|
|
`tag_category_name_regex` from server's configuration.
|
2016-04-19 00:18:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
## Updating tag category
|
2016-04-19 11:56:09 +02:00
|
|
|
- **Request**
|
2016-04-19 00:18:35 +02:00
|
|
|
|
2016-04-19 11:56:09 +02:00
|
|
|
`PUT /tag-category/<name>`
|
|
|
|
|
|
|
|
- **Input**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"name": <name>, // optional
|
|
|
|
"color": <color>, // optional
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
- **Output**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
2016-04-20 11:15:36 +02:00
|
|
|
"tagCategory": <tag-category>,
|
|
|
|
"snapshots": [
|
2016-04-21 18:59:44 +02:00
|
|
|
<snapshot>,
|
|
|
|
<snapshot>,
|
|
|
|
<snapshot>
|
2016-04-20 11:15:36 +02:00
|
|
|
]
|
2016-04-19 11:56:09 +02:00
|
|
|
}
|
|
|
|
```
|
2016-04-20 11:15:36 +02:00
|
|
|
...where `<tag-category>` is a [tag category resource](#tag-category), and
|
|
|
|
`snapshots` contain its earlier versions.
|
2016-04-19 11:56:09 +02:00
|
|
|
|
|
|
|
- **Errors**
|
|
|
|
|
|
|
|
- the tag category does not exist
|
|
|
|
- the name is used by an existing tag category (names are case insensitive)
|
|
|
|
- the name is invalid
|
|
|
|
- the color is invalid
|
|
|
|
- privileges are too low
|
|
|
|
|
|
|
|
- **Description**
|
|
|
|
|
|
|
|
Updates an existing tag category using specified parameters. Name must
|
|
|
|
match `tag_category_name_regex` from server's configuration. All fields are
|
|
|
|
optional - update concerns only provided fields.
|
2016-04-19 00:18:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
## Getting tag category
|
2016-04-19 11:56:09 +02:00
|
|
|
- **Request**
|
|
|
|
|
|
|
|
`GET /tag-category/<name>`
|
|
|
|
|
|
|
|
- **Output**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
2016-04-20 11:15:36 +02:00
|
|
|
"tagCategory": <tag-category>,
|
|
|
|
"snapshots": [
|
2016-04-21 18:59:44 +02:00
|
|
|
<snapshot>,
|
|
|
|
<snapshot>,
|
|
|
|
<snapshot>
|
2016-04-20 11:15:36 +02:00
|
|
|
]
|
2016-04-19 11:56:09 +02:00
|
|
|
}
|
|
|
|
```
|
2016-04-20 11:15:36 +02:00
|
|
|
...where `<tag-category>` is a [tag category resource](#tag-category), and
|
|
|
|
`snapshots` contain its earlier versions.
|
2016-04-19 11:56:09 +02:00
|
|
|
|
|
|
|
- **Errors**
|
|
|
|
|
|
|
|
- the tag category does not exist
|
|
|
|
- privileges are too low
|
2016-04-19 00:18:35 +02:00
|
|
|
|
2016-04-19 11:56:09 +02:00
|
|
|
- **Description**
|
|
|
|
|
|
|
|
Retrieves information about an existing tag category.
|
2016-04-19 00:18:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
## Deleting tag category
|
2016-04-19 11:56:09 +02:00
|
|
|
- **Request**
|
|
|
|
|
|
|
|
`DELETE /tag-category/<name>`
|
|
|
|
|
|
|
|
- **Output**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{}
|
|
|
|
```
|
|
|
|
|
|
|
|
- **Errors**
|
|
|
|
|
|
|
|
- the tag category does not exist
|
|
|
|
- the tag category is used by some tags
|
2016-04-19 15:45:12 +02:00
|
|
|
- the tag category is the last tag category available
|
2016-04-19 11:56:09 +02:00
|
|
|
- privileges are too low
|
|
|
|
|
|
|
|
- **Description**
|
2016-04-19 00:18:35 +02:00
|
|
|
|
2016-04-19 11:56:09 +02:00
|
|
|
Deletes existing tag category. The tag category to be deleted must have no
|
|
|
|
usages.
|
2016-04-19 00:18:35 +02:00
|
|
|
|
|
|
|
|
2016-04-15 23:02:30 +02:00
|
|
|
## Listing tags
|
2016-04-16 20:55:15 +02:00
|
|
|
- **Request**
|
|
|
|
|
|
|
|
`GET /tags/?page=<page>&pageSize=<page-size>&query=<query>`
|
|
|
|
|
|
|
|
- **Output**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
2016-04-21 18:59:44 +02:00
|
|
|
"query": <query>, // same as in input
|
|
|
|
"page": <page>, // same as in input
|
|
|
|
"pageSize": <page-size>,
|
|
|
|
"total": <total-count>,
|
2016-04-16 20:55:15 +02:00
|
|
|
"tags": [
|
|
|
|
<tag>,
|
|
|
|
<tag>,
|
|
|
|
<tag>
|
2016-04-21 18:59:44 +02:00
|
|
|
]
|
2016-04-16 20:55:15 +02:00
|
|
|
}
|
|
|
|
```
|
|
|
|
...where `<tag>` is a [tag resource](#tag) and `query` contains standard
|
|
|
|
[search query](#search).
|
|
|
|
|
|
|
|
- **Errors**
|
|
|
|
|
|
|
|
- privileges are too low
|
|
|
|
|
|
|
|
- **Description**
|
|
|
|
|
|
|
|
Searches for tags.
|
|
|
|
|
2016-04-16 22:57:02 +02:00
|
|
|
**Note**: independently, the server exports current tag list snapshots to
|
|
|
|
the data directory under `tags.json` name. Its purpose is to reduce the
|
|
|
|
trips frontend needs to make when doing autocompletion, and ease caching.
|
|
|
|
The data directory and its URL are controlled with `data_dir` and
|
|
|
|
`data_url` variables in server's configuration.
|
|
|
|
|
2016-04-16 20:55:15 +02:00
|
|
|
**Anonymous tokens**
|
|
|
|
|
|
|
|
Same as `name` token.
|
|
|
|
|
|
|
|
**Named tokens**
|
|
|
|
|
|
|
|
| `<value>` | Description |
|
|
|
|
| ------------------- | ------------------------------------- |
|
|
|
|
| `name` | having given name (accepts wildcards) |
|
|
|
|
| `category` | having given category |
|
|
|
|
| `creation-date` | created at given date |
|
|
|
|
| `creation-time` | alias of `creation-date` |
|
|
|
|
| `last-edit-date` | edited at given date |
|
|
|
|
| `last-edit-time` | alias of `last-edit-date` |
|
|
|
|
| `edit-date` | alias of `last-edit-date` |
|
|
|
|
| `edit-time` | alias of `last-edit-date` |
|
|
|
|
| `usages` | used in given number of posts |
|
|
|
|
| `usage-count` | alias of `usages` |
|
|
|
|
| `post-count` | alias of `usages` |
|
|
|
|
| `suggestion-count` | with given number of suggestions |
|
|
|
|
| `implication-count` | with given number of implications |
|
|
|
|
|
2016-04-22 19:37:58 +02:00
|
|
|
**Sort style tokens**
|
2016-04-16 20:55:15 +02:00
|
|
|
|
|
|
|
| `<value>` | Description |
|
|
|
|
| ------------------- | ---------------------------- |
|
|
|
|
| `random` | as random as it can get |
|
|
|
|
| `name` | A to Z |
|
|
|
|
| `category` | category (A to Z) |
|
|
|
|
| `creation-date` | recently created first |
|
|
|
|
| `creation-time` | alias of `creation-date` |
|
|
|
|
| `last-edit-date` | recently edited first |
|
|
|
|
| `last-edit-time` | alias of `creation-time` |
|
|
|
|
| `edit-date` | alias of `creation-time` |
|
|
|
|
| `edit-time` | alias of `creation-time` |
|
|
|
|
| `usages` | used in most posts first |
|
|
|
|
| `usage-count` | alias of `usages` |
|
|
|
|
| `post-count` | alias of `usages` |
|
|
|
|
| `suggestion-count` | with most suggestions first |
|
|
|
|
| `implication-count` | with most implications first |
|
|
|
|
|
|
|
|
**Special tokens**
|
|
|
|
|
|
|
|
None.
|
2016-04-15 23:02:30 +02:00
|
|
|
|
2016-04-16 10:57:42 +02:00
|
|
|
|
2016-04-15 23:02:30 +02:00
|
|
|
## Creating tag
|
|
|
|
- **Request**
|
|
|
|
|
|
|
|
`POST /tags`
|
|
|
|
|
|
|
|
- **Input**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"names": [<name1>, <name2>, ...],
|
|
|
|
"category": <category>,
|
2016-04-19 00:18:35 +02:00
|
|
|
"implications": [<name1>, <name2>, ...], // optional
|
|
|
|
"suggestions": [<name1>, <name2>, ...] // optional
|
2016-04-15 23:02:30 +02:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
- **Output**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
2016-04-20 11:15:36 +02:00
|
|
|
"tag": <tag>,
|
|
|
|
"snapshots": [
|
2016-04-21 18:59:44 +02:00
|
|
|
<snapshot>,
|
|
|
|
<snapshot>,
|
|
|
|
<snapshot>
|
2016-04-20 11:15:36 +02:00
|
|
|
]
|
2016-04-15 23:02:30 +02:00
|
|
|
}
|
|
|
|
```
|
2016-04-20 11:15:36 +02:00
|
|
|
...where `<tag>` is a [tag resource](#tag), and `snapshots` contain its
|
|
|
|
earlier versions.
|
2016-04-15 23:02:30 +02:00
|
|
|
|
|
|
|
- **Errors**
|
|
|
|
|
|
|
|
- any name is used by an existing tag (names are case insensitive)
|
2016-04-19 15:45:12 +02:00
|
|
|
- any name, implication or is invalid
|
2016-04-15 23:02:30 +02:00
|
|
|
- category is invalid
|
|
|
|
- no name was specified
|
2016-04-16 10:57:42 +02:00
|
|
|
- implications or suggestions contain any item from names (e.g. there's a
|
|
|
|
shallow cyclic dependency)
|
2016-04-15 23:02:30 +02:00
|
|
|
- privileges are too low
|
|
|
|
|
|
|
|
- **Description**
|
|
|
|
|
|
|
|
Creates a new tag using specified parameters. Names, suggestions and
|
|
|
|
implications must match `tag_name_regex` from server's configuration.
|
2016-04-19 00:18:35 +02:00
|
|
|
Category must exist and is the same as `name` field within
|
|
|
|
[`<tag-category>` resource](#tag-category). Suggestions and implications
|
|
|
|
are optional. If specified implied tags or suggested tags do not exist yet,
|
|
|
|
they will be automatically created. Tags created automatically have no
|
|
|
|
implications, no suggestions, one name and their category is set to the
|
2016-04-19 11:50:47 +02:00
|
|
|
first tag category found. If there are no tag categories established yet,
|
|
|
|
an error will be thrown.
|
2016-04-15 23:02:30 +02:00
|
|
|
|
2016-04-16 10:57:42 +02:00
|
|
|
|
2016-04-15 23:02:30 +02:00
|
|
|
## Updating tag
|
2016-04-16 10:57:42 +02:00
|
|
|
- **Request**
|
|
|
|
|
|
|
|
`PUT /tags/<name>`
|
|
|
|
|
|
|
|
- **Input**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
2016-04-17 19:02:39 +02:00
|
|
|
"names": [<name1>, <name2>, ...], // optional
|
|
|
|
"category": <category>, // optional
|
|
|
|
"implications": [<name1>, <name2>, ...], // optional
|
|
|
|
"suggestions": [<name1>, <name2>, ...] // optional
|
2016-04-16 10:57:42 +02:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
- **Output**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
2016-04-20 11:15:36 +02:00
|
|
|
"tag": <tag>,
|
|
|
|
"snapshots": [
|
2016-04-21 18:59:44 +02:00
|
|
|
<snapshot>,
|
|
|
|
<snapshot>,
|
|
|
|
<snapshot>
|
2016-04-20 11:15:36 +02:00
|
|
|
]
|
2016-04-16 10:57:42 +02:00
|
|
|
}
|
|
|
|
```
|
2016-04-20 11:15:36 +02:00
|
|
|
...where `<tag>` is a [tag resource](#tag), and `snapshots` contain its
|
|
|
|
earlier versions.
|
2016-04-16 10:57:42 +02:00
|
|
|
|
|
|
|
- **Errors**
|
|
|
|
|
2016-04-19 11:50:47 +02:00
|
|
|
- the tag does not exist
|
2016-04-16 10:57:42 +02:00
|
|
|
- any name is used by an existing tag (names are case insensitive)
|
2016-04-19 11:50:47 +02:00
|
|
|
- any name, implication or suggestion name is invalid
|
2016-04-16 10:57:42 +02:00
|
|
|
- category is invalid
|
|
|
|
- implications or suggestions contain any item from names (e.g. there's a
|
|
|
|
shallow cyclic dependency)
|
|
|
|
- privileges are too low
|
|
|
|
|
|
|
|
- **Description**
|
|
|
|
|
|
|
|
Updates an existing tag using specified parameters. Names, suggestions and
|
|
|
|
implications must match `tag_name_regex` from server's configuration.
|
2016-04-19 15:45:12 +02:00
|
|
|
Category must exist and is the same as `name` field within
|
|
|
|
[`<tag-category>` resource](#tag-category). If specified implied tags or
|
|
|
|
suggested tags do not exist yet, they will be automatically created. Tags
|
|
|
|
created automatically have no implications, no suggestions, one name and
|
|
|
|
their category is set to the first tag category found. All fields are
|
|
|
|
optional - update concerns only provided fields.
|
2016-04-16 10:57:42 +02:00
|
|
|
|
2016-04-15 23:02:30 +02:00
|
|
|
|
|
|
|
## Getting tag
|
2016-04-16 17:26:10 +02:00
|
|
|
- **Request**
|
|
|
|
|
|
|
|
`GET /tag/<name>`
|
|
|
|
|
|
|
|
- **Output**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
2016-04-20 11:15:36 +02:00
|
|
|
"tag": <tag>,
|
|
|
|
"snapshots": [
|
2016-04-21 18:59:44 +02:00
|
|
|
<snapshot>,
|
|
|
|
<snapshot>,
|
|
|
|
<snapshot>
|
2016-04-20 11:15:36 +02:00
|
|
|
]
|
2016-04-16 17:26:10 +02:00
|
|
|
}
|
|
|
|
```
|
2016-04-20 11:15:36 +02:00
|
|
|
...where `<tag>` is a [tag resource](#tag), and `snapshots` contain its
|
|
|
|
earlier versions.
|
2016-04-16 17:26:10 +02:00
|
|
|
|
|
|
|
- **Errors**
|
|
|
|
|
|
|
|
- the tag does not exist
|
|
|
|
- privileges are too low
|
|
|
|
|
|
|
|
- **Description**
|
|
|
|
|
|
|
|
Retrieves information about an existing tag.
|
2016-04-15 23:02:30 +02:00
|
|
|
|
2016-04-16 10:57:42 +02:00
|
|
|
|
2016-04-16 17:03:28 +02:00
|
|
|
## Deleting tag
|
|
|
|
- **Request**
|
|
|
|
|
|
|
|
`DELETE /tag/<name>`
|
|
|
|
|
|
|
|
- **Output**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{}
|
|
|
|
```
|
|
|
|
|
|
|
|
- **Errors**
|
|
|
|
|
|
|
|
- the tag does not exist
|
|
|
|
- the tag is used by some posts
|
|
|
|
- privileges are too low
|
|
|
|
|
|
|
|
- **Description**
|
|
|
|
|
2016-04-19 11:50:47 +02:00
|
|
|
Deletes existing tag. The tag to be deleted must have no usages.
|
2016-04-15 23:02:30 +02:00
|
|
|
|
|
|
|
|
2016-04-20 19:02:39 +02:00
|
|
|
## Merging tags
|
|
|
|
- **Request**
|
|
|
|
|
|
|
|
`POST /tag-merge/`
|
|
|
|
|
|
|
|
- **Input**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
2016-04-21 18:59:44 +02:00
|
|
|
"remove": <source-tag-name>,
|
|
|
|
"merge-to": <target-tag-name>
|
2016-04-20 19:02:39 +02:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
- **Output**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"tag": <tag>,
|
|
|
|
"snapshots": [
|
2016-04-21 18:59:44 +02:00
|
|
|
<snapshot>,
|
|
|
|
<snapshot>,
|
|
|
|
<snapshot>
|
2016-04-20 19:02:39 +02:00
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
...where `<tag>` is the target [tag resource](#tag), and `snapshots`
|
|
|
|
contain its earlier versions.
|
|
|
|
|
|
|
|
- **Errors**
|
|
|
|
|
|
|
|
- the source or target tag does not exist
|
|
|
|
- the source tag is the same as the target tag
|
|
|
|
- privileges are too low
|
|
|
|
|
|
|
|
- **Description**
|
|
|
|
|
|
|
|
Removes source tag and merges all of its usages to the target tag. Source
|
|
|
|
tag properties such as category, tag relations etc. do not get transferred
|
|
|
|
and are discarded. The target tag effectively remains unchanged with the
|
|
|
|
exception of the set of posts it's used in.
|
|
|
|
|
|
|
|
|
2016-04-20 21:31:46 +02:00
|
|
|
## Listing tag siblings
|
|
|
|
- **Request**
|
|
|
|
|
|
|
|
`GET /tag-siblings/<name>`
|
|
|
|
|
|
|
|
- **Output**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"siblings": [
|
|
|
|
{
|
|
|
|
"tag": <tag>,
|
2016-04-21 18:59:44 +02:00
|
|
|
"occurrences": <occurrence-count>
|
2016-04-20 21:31:46 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"tag": <tag>,
|
2016-04-21 18:59:44 +02:00
|
|
|
"occurrences": <occurrence-count>
|
2016-04-20 21:31:46 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
...where `<tag>` is a [tag resource](#tag).
|
|
|
|
|
|
|
|
- **Errors**
|
|
|
|
|
|
|
|
- privileges are too low
|
|
|
|
|
|
|
|
- **Description**
|
|
|
|
|
|
|
|
Lists siblings of given tag, e.g. tags that were used in the same posts as
|
|
|
|
the given tag. `occurrences` field signifies how many times a given sibling
|
|
|
|
appears with given tag. Results are sorted by occurrences count and the
|
|
|
|
list is truncated to the first 50 elements. Doesn't use paging.
|
|
|
|
|
|
|
|
|
2016-04-24 16:34:06 +02:00
|
|
|
## Rating post
|
|
|
|
- **Request**
|
|
|
|
|
|
|
|
`PUT /post/<id>/score`
|
|
|
|
|
|
|
|
- **Input**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"score": <score>
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
- **Output**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"post": <post>
|
|
|
|
}
|
|
|
|
```
|
|
|
|
...where `<post>` is a [post resource](#post).
|
|
|
|
|
|
|
|
- **Errors**
|
|
|
|
|
|
|
|
- post does not exist
|
|
|
|
- score is invalid
|
|
|
|
- privileges are too low
|
|
|
|
|
|
|
|
- **Description**
|
|
|
|
|
|
|
|
Updates score of authenticated user for given post. Valid scores are -1, 0
|
|
|
|
and 1.
|
|
|
|
|
|
|
|
|
2016-04-23 08:07:21 +02:00
|
|
|
## Getting featured post
|
|
|
|
- **Request**
|
|
|
|
|
|
|
|
`GET /featured-post`
|
|
|
|
|
|
|
|
- **Output**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"post": <post>,
|
|
|
|
"snapshots": [
|
|
|
|
<snapshot>,
|
|
|
|
<snapshot>,
|
|
|
|
<snapshot>
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
...where `<post>` is a [post resource](#post), and `snapshots` contain its
|
|
|
|
earlier versions.
|
|
|
|
|
|
|
|
- **Errors**
|
|
|
|
|
|
|
|
- privileges are too low
|
|
|
|
|
|
|
|
- **Description**
|
|
|
|
|
|
|
|
Retrieves the post that is currently featured on the main page in web
|
|
|
|
client. If no post is featured, `<post>` is null and `snapshots` array is
|
|
|
|
empty.
|
|
|
|
|
|
|
|
|
2016-04-22 20:58:04 +02:00
|
|
|
## Featuring post
|
|
|
|
- **Request**
|
|
|
|
|
|
|
|
`POST /featured-post`
|
|
|
|
|
|
|
|
- **Output**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"post": <post>,
|
|
|
|
"snapshots": [
|
|
|
|
<snapshot>,
|
|
|
|
<snapshot>,
|
|
|
|
<snapshot>
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
...where `<post>` is a [post resource](#post), and `snapshots` contain its
|
|
|
|
earlier versions.
|
|
|
|
|
|
|
|
- **Errors**
|
|
|
|
|
|
|
|
- privileges are too low
|
|
|
|
- trying to feature a post that is currently featured
|
|
|
|
|
|
|
|
- **Description**
|
|
|
|
|
2016-04-23 08:07:21 +02:00
|
|
|
Features a post on the main page in web client.
|
2016-04-22 20:58:04 +02:00
|
|
|
|
|
|
|
|
2016-04-24 11:24:52 +02:00
|
|
|
## Listing comments
|
|
|
|
- **Request**
|
|
|
|
|
|
|
|
`GET /comments/?page=<page>&pageSize=<page-size>&query=<query>`
|
|
|
|
|
|
|
|
- **Output**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"query": <query>, // same as in input
|
|
|
|
"page": <page>, // same as in input
|
|
|
|
"pageSize": <page-size>,
|
|
|
|
"total": <total-count>,
|
|
|
|
"comments": [
|
|
|
|
<comment>,
|
|
|
|
<comment>,
|
|
|
|
<comment>
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
...where `<comment>` is a [comment resource](#comment) and `query` contains
|
|
|
|
standard [search query](#search).
|
|
|
|
|
|
|
|
- **Errors**
|
|
|
|
|
|
|
|
- privileges are too low
|
|
|
|
|
|
|
|
- **Description**
|
|
|
|
|
|
|
|
Searches for comments.
|
|
|
|
|
|
|
|
**Anonymous tokens**
|
|
|
|
|
|
|
|
Same as `text` token.
|
|
|
|
|
|
|
|
**Named tokens**
|
|
|
|
|
|
|
|
| `<value>` | Description |
|
|
|
|
| ---------------- | ---------------------------------------------- |
|
|
|
|
| `id` | specific comment ID |
|
|
|
|
| `post` | specific post ID |
|
|
|
|
| `user` | created by given user (accepts wildcards) |
|
|
|
|
| `text` | containing given text (accepts wildcards) |
|
|
|
|
| `creation-date` | created at given date |
|
|
|
|
| `creation-time` | alias of `creation-date` |
|
|
|
|
| `last-edit-date` | whose most recent edit date matches given date |
|
|
|
|
| `last-edit-time` | alias of `last-edit-date` |
|
|
|
|
| `edit-date` | alias of `last-edit-date` |
|
|
|
|
| `edit-time` | alias of `last-edit-date` |
|
|
|
|
|
|
|
|
**Sort style tokens**
|
|
|
|
|
|
|
|
| `<value>` | Description |
|
|
|
|
| ---------------- | ------------------------- |
|
|
|
|
| `random` | as random as it can get |
|
|
|
|
| `user` | author name, A to Z |
|
|
|
|
| `post` | post ID, newest to oldest |
|
|
|
|
| `creation-date` | newest to oldest |
|
|
|
|
| `creation-time` | alias of `creation-date` |
|
|
|
|
| `last-edit-date` | recently edited first |
|
|
|
|
| `last-edit-time` | alias of `last-edit-date` |
|
|
|
|
| `edit-date` | alias of `last-edit-date` |
|
|
|
|
| `edit-time` | alias of `last-edit-date` |
|
|
|
|
|
|
|
|
**Special tokens**
|
|
|
|
|
|
|
|
None.
|
|
|
|
|
|
|
|
|
2016-04-24 09:50:11 +02:00
|
|
|
## Creating comment
|
|
|
|
- **Request**
|
|
|
|
|
|
|
|
`POST /comments/`
|
|
|
|
|
|
|
|
- **Input**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"text": <text>,
|
|
|
|
"postId": <post-id>
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
- **Output**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"comment": <comment>
|
|
|
|
}
|
|
|
|
```
|
|
|
|
...where `<comment>` is a [comment resource](#comment).
|
|
|
|
|
|
|
|
- **Errors**
|
|
|
|
|
2016-04-24 10:13:22 +02:00
|
|
|
- the post does not exist
|
2016-04-24 09:50:11 +02:00
|
|
|
- comment text is empty
|
|
|
|
- privileges are too low
|
|
|
|
|
|
|
|
- **Description**
|
|
|
|
|
|
|
|
Creates a new comment under given post.
|
|
|
|
|
|
|
|
|
2016-04-24 10:13:22 +02:00
|
|
|
## Updating comment
|
|
|
|
- **Request**
|
|
|
|
|
|
|
|
`PUT /comment/<id>`
|
|
|
|
|
|
|
|
- **Input**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"text": <new-text> // mandatory
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
- **Output**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"comment": <comment>
|
|
|
|
}
|
|
|
|
```
|
|
|
|
...where `<comment>` is a [comment resource](#comment).
|
|
|
|
|
|
|
|
- **Errors**
|
|
|
|
|
|
|
|
- the comment does not exist
|
|
|
|
- new comment text is empty
|
|
|
|
- privileges are too low
|
|
|
|
|
|
|
|
- **Description**
|
|
|
|
|
|
|
|
Updates an existing comment text.
|
|
|
|
|
|
|
|
|
2016-04-24 11:22:18 +02:00
|
|
|
## Getting comment
|
|
|
|
- **Request**
|
|
|
|
|
|
|
|
`GET /comment/<id>`
|
|
|
|
|
|
|
|
- **Output**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"comment": <comment>
|
|
|
|
}
|
|
|
|
```
|
|
|
|
...where `<comment>` is a [comment resource](#comment).
|
|
|
|
|
|
|
|
- **Errors**
|
|
|
|
|
|
|
|
- the comment does not exist
|
|
|
|
- privileges are too low
|
|
|
|
|
|
|
|
- **Description**
|
|
|
|
|
|
|
|
Retrieves information about an existing comment.
|
|
|
|
|
|
|
|
|
2016-04-24 11:15:03 +02:00
|
|
|
## Deleting comment
|
|
|
|
- **Request**
|
|
|
|
|
|
|
|
`DELETE /comment/<id>`
|
|
|
|
|
|
|
|
- **Output**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{}
|
|
|
|
```
|
|
|
|
|
|
|
|
- **Errors**
|
|
|
|
|
|
|
|
- the comment does not exist
|
|
|
|
- privileges are too low
|
|
|
|
|
|
|
|
- **Description**
|
|
|
|
|
|
|
|
Deletes existing comment.
|
|
|
|
|
|
|
|
|
2016-04-24 16:34:06 +02:00
|
|
|
## Rating comment
|
|
|
|
- **Request**
|
|
|
|
|
|
|
|
`PUT /comment/<id>/score`
|
|
|
|
|
|
|
|
- **Input**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"score": <score>
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
- **Output**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"comment": <comment>
|
|
|
|
}
|
|
|
|
```
|
|
|
|
...where `<comment>` is a [comment resource](#comment).
|
|
|
|
|
|
|
|
- **Errors**
|
|
|
|
|
|
|
|
- comment does not exist
|
|
|
|
- score is invalid
|
|
|
|
- privileges are too low
|
|
|
|
|
|
|
|
- **Description**
|
|
|
|
|
|
|
|
Updates score of authenticated user for given comment. Valid scores are -1,
|
|
|
|
0 and 1.
|
|
|
|
|
|
|
|
|
2016-04-13 13:33:03 +02:00
|
|
|
## Listing users
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Request**
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
`GET /users/?page=<page>&pageSize=<page-size>&query=<query>`
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Output**
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
```json5
|
|
|
|
{
|
2016-04-21 18:59:44 +02:00
|
|
|
"query": <query>, // same as in input
|
|
|
|
"page": <page>, // same as in input
|
|
|
|
"pageSize": <page-size>,
|
|
|
|
"total": <total-count>,
|
2016-04-14 19:37:05 +02:00
|
|
|
"users": [
|
|
|
|
<user>,
|
|
|
|
<user>,
|
|
|
|
<user>
|
2016-04-21 18:59:44 +02:00
|
|
|
]
|
2016-04-14 19:37:05 +02:00
|
|
|
}
|
|
|
|
```
|
2016-04-15 23:02:30 +02:00
|
|
|
...where `<user>` is a [user resource](#user) and `query` contains standard
|
2016-04-14 19:37:05 +02:00
|
|
|
[search query](#search).
|
|
|
|
|
|
|
|
- **Errors**
|
|
|
|
|
|
|
|
- privileges are too low
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Description**
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
Searches for users.
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
**Anonymous tokens**
|
2016-04-09 08:59:40 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
Same as `name` token.
|
2016-04-09 08:59:40 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
**Named tokens**
|
2016-04-09 08:59:40 +02:00
|
|
|
|
2016-04-16 20:55:15 +02:00
|
|
|
| `<value>` | Description |
|
|
|
|
| ----------------- | ----------------------------------------------- |
|
|
|
|
| `name` | having given name (accepts wildcards) |
|
|
|
|
| `creation-date` | registered at given date |
|
|
|
|
| `creation-time` | alias of `creation-date` |
|
|
|
|
| `last-login-date` | whose most recent login date matches given date |
|
|
|
|
| `last-login-time` | alias of `last-login-date` |
|
|
|
|
| `login-date` | alias of `last-login-date` |
|
|
|
|
| `login-time` | alias of `last-login-date` |
|
2016-04-09 08:59:40 +02:00
|
|
|
|
2016-04-22 19:37:58 +02:00
|
|
|
**Sort style tokens**
|
2016-04-09 08:59:40 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
| `<value>` | Description |
|
|
|
|
| ----------------- | -------------------------- |
|
|
|
|
| `random` | as random as it can get |
|
|
|
|
| `name` | A to Z |
|
|
|
|
| `creation-date` | newest to oldest |
|
|
|
|
| `creation-time` | alias of `creation-date` |
|
|
|
|
| `last-login-date` | recently active first |
|
|
|
|
| `last-login-time` | alias of `last-login-date` |
|
|
|
|
| `login-date` | alias of `last-login-date` |
|
|
|
|
| `login-time` | alias of `last-login-date` |
|
2016-04-09 08:59:40 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
**Special tokens**
|
2016-04-09 08:59:40 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
None.
|
2016-04-09 08:59:40 +02:00
|
|
|
|
2016-04-16 17:03:28 +02:00
|
|
|
|
2016-04-13 13:33:03 +02:00
|
|
|
## Creating user
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Request**
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
`POST /users`
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Input**
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"name": <user-name>,
|
|
|
|
"password": <user-password>,
|
2016-04-17 19:02:39 +02:00
|
|
|
"email": <email>, // optional
|
|
|
|
"rank": <rank>, // optional
|
|
|
|
"avatarStyle": <avatar-style> // optional
|
2016-04-14 19:37:05 +02:00
|
|
|
}
|
|
|
|
```
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-17 19:02:39 +02:00
|
|
|
- **Files**
|
|
|
|
|
|
|
|
- `avatar` - the content of the new avatar (optional).
|
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Output**
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"user": <user>
|
|
|
|
}
|
|
|
|
```
|
2016-04-15 23:02:30 +02:00
|
|
|
...where `<user>` is a [user resource](#user).
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Errors**
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-17 19:02:39 +02:00
|
|
|
- a user with such name already exists (names are case insensitive)
|
|
|
|
- either user name, password, email or rank are invalid
|
|
|
|
- the user is trying to update their or someone else's rank to higher than
|
|
|
|
their own
|
|
|
|
- avatar is missing for manual avatar style
|
2016-04-14 19:37:05 +02:00
|
|
|
- privileges are too low
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Description**
|
2016-04-09 08:59:40 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
Creates a new user using specified parameters. Names and passwords must
|
|
|
|
match `user_name_regex` and `password_regex` from server's configuration,
|
2016-04-17 19:02:39 +02:00
|
|
|
respectively. Email address, rank and avatar fields are optional. Avatar
|
|
|
|
style can be either `gravatar` or `manual`. `manual` avatar style requires
|
|
|
|
client to pass also `avatar` file - see [file uploads](#file-uploads) for
|
|
|
|
details. If the rank is empty and the user happens to be the first user
|
|
|
|
ever created, they're granted highest available rank, becoming an
|
|
|
|
administrator, whereas subsequent users will be given the rank indicated by
|
2016-04-14 19:37:05 +02:00
|
|
|
`default_rank` in the server's configuration.
|
2016-04-09 08:59:40 +02:00
|
|
|
|
|
|
|
|
2016-04-13 13:33:03 +02:00
|
|
|
## Updating user
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Request**
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
`PUT /user/<name>`
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Input**
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
```json5
|
|
|
|
{
|
2016-04-17 19:02:39 +02:00
|
|
|
"name": <user-name>, // optional
|
|
|
|
"password": <user-password>, // optional
|
|
|
|
"email": <email>, // optional
|
|
|
|
"rank": <rank>, // optional
|
|
|
|
"avatarStyle": <avatar-style> // optional
|
2016-04-14 19:37:05 +02:00
|
|
|
}
|
|
|
|
```
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Files**
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-17 19:02:39 +02:00
|
|
|
- `avatar` - the content of the new avatar (optional).
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Output**
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"user": <user>
|
|
|
|
}
|
|
|
|
```
|
2016-04-15 23:02:30 +02:00
|
|
|
...where `<user>` is a [user resource](#user).
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Errors**
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- the user does not exist
|
2016-04-17 19:02:39 +02:00
|
|
|
- a user with new name already exists (names are case insensitive)
|
2016-04-14 19:37:05 +02:00
|
|
|
- either user name, password, email or rank are invalid
|
|
|
|
- the user is trying to update their or someone else's rank to higher than
|
|
|
|
their own
|
|
|
|
- avatar is missing for manual avatar style
|
2016-04-17 19:02:39 +02:00
|
|
|
- privileges are too low
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Description**
|
2016-04-09 08:59:40 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
Updates an existing user using specified parameters. Names and passwords
|
|
|
|
must match `user_name_regex` and `password_regex` from server's
|
|
|
|
configuration, respectively. All fields are optional - update concerns only
|
|
|
|
provided fields. To update last login time, see
|
|
|
|
[authentication](#authentication). Avatar style can be either `gravatar` or
|
|
|
|
`manual`. `manual` avatar style requires client to pass also `avatar`
|
|
|
|
file - see [file uploads](#file-uploads) for details.
|
2016-04-09 08:59:40 +02:00
|
|
|
|
|
|
|
|
2016-04-13 13:33:03 +02:00
|
|
|
## Getting user
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Request**
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
`GET /user/<name>`
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Output**
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"user": <user>
|
|
|
|
}
|
|
|
|
```
|
2016-04-15 23:02:30 +02:00
|
|
|
...where `<user>` is a [user resource](#user).
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Errors**
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- the user does not exist
|
|
|
|
- privileges are too low
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Description**
|
2016-04-09 08:59:40 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
Retrieves information about an existing user.
|
2016-04-09 08:59:40 +02:00
|
|
|
|
|
|
|
|
2016-04-16 17:03:28 +02:00
|
|
|
## Deleting user
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Request**
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
`DELETE /user/<name>`
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Output**
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
```json5
|
|
|
|
{}
|
|
|
|
```
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Errors**
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- the user does not exist
|
|
|
|
- privileges are too low
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Description**
|
2016-04-09 09:21:56 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
Deletes existing user.
|
2016-04-09 09:21:56 +02:00
|
|
|
|
|
|
|
|
2016-04-13 13:33:03 +02:00
|
|
|
## Password reset - step 1: mail request
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Request**
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
`GET /password-reset/<email-or-name>`
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Output**
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
```
|
|
|
|
{}
|
|
|
|
```
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Errors**
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- the user does not exist
|
|
|
|
- the user hasn't provided an email address
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Description**
|
2016-04-09 08:59:40 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
Sends a confirmation email to given user. The email contains link
|
|
|
|
containing a token. The token cannot be guessed, thus using such link
|
|
|
|
proves that the person who requested to reset the password also owns the
|
|
|
|
mailbox, which is a strong indication they are the rightful owner of the
|
|
|
|
account.
|
2016-04-09 08:59:40 +02:00
|
|
|
|
|
|
|
|
2016-04-13 13:33:03 +02:00
|
|
|
## Password reset - step 2: confirmation
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Request**
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
`POST /password-reset/<email-or-name>`
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Input**
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"token": <token-from-email>
|
|
|
|
}
|
|
|
|
```
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Output**
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"password": <new-password>
|
|
|
|
}
|
|
|
|
```
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Errors**
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- the token is missing
|
|
|
|
- the token is invalid
|
|
|
|
- the user does not exist
|
2016-04-13 13:33:03 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- **Description**
|
2016-04-09 08:59:40 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
Generates a new password for given user. Password is sent as plain-text, so
|
|
|
|
it is recommended to connect through HTTPS.
|
2016-04-09 08:59:40 +02:00
|
|
|
|
|
|
|
|
2016-04-21 19:25:38 +02:00
|
|
|
## Listing snapshots
|
|
|
|
- **Request**
|
|
|
|
|
|
|
|
`GET /snapshots/?page=<page>&pageSize=<page-size>&query=<query>`
|
|
|
|
|
|
|
|
- **Output**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"query": <query>, // same as in input
|
|
|
|
"page": <page>, // same as in input
|
|
|
|
"pageSize": <page-size>,
|
|
|
|
"total": <total-count>,
|
|
|
|
"snapshots": [
|
|
|
|
<snapshot>,
|
|
|
|
<snapshot>,
|
|
|
|
<snapshot>
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
...where `<snapshot>` is a [snapshot resource](#snapshot) and `query`
|
|
|
|
contains standard [search query](#search).
|
|
|
|
|
|
|
|
- **Errors**
|
|
|
|
|
|
|
|
- privileges are too low
|
|
|
|
|
|
|
|
- **Description**
|
|
|
|
|
|
|
|
Lists recent resource snapshots.
|
|
|
|
|
|
|
|
**Anonymous tokens**
|
|
|
|
|
|
|
|
Not supported.
|
|
|
|
|
|
|
|
**Named tokens**
|
|
|
|
|
|
|
|
| `<value>` | Description |
|
|
|
|
| ----------------- | --------------------------------------------- |
|
|
|
|
| `type` | involving given resource type |
|
|
|
|
| `id` | involving given resource id |
|
|
|
|
| `date` | created at given date |
|
|
|
|
| `time` | alias of `date` |
|
|
|
|
| `operation` | `changed`, `created` or `deleted` |
|
|
|
|
| `user` | name of the user that created given snapshot |
|
|
|
|
|
2016-04-22 19:37:58 +02:00
|
|
|
**Sort style tokens**
|
2016-04-21 19:25:38 +02:00
|
|
|
|
|
|
|
None. The snapshots are always sorted by creation time.
|
|
|
|
|
|
|
|
**Special tokens**
|
|
|
|
|
|
|
|
None.
|
|
|
|
|
|
|
|
|
2016-04-23 08:07:21 +02:00
|
|
|
## Getting global info
|
|
|
|
- **Request**
|
|
|
|
|
|
|
|
`GET /info`
|
|
|
|
|
|
|
|
- **Output**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"postCount": <post-count>,
|
|
|
|
"diskUsage": <disk-usage>, // in bytes
|
|
|
|
"featuredPost": <featured-post>
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
- **Description**
|
|
|
|
|
|
|
|
Retrieves simple statistics. `<featured-post>` is null if there is no
|
|
|
|
featured post yet.
|
|
|
|
|
|
|
|
|
2016-04-09 08:59:40 +02:00
|
|
|
|
2016-04-13 13:33:03 +02:00
|
|
|
# Resources
|
2016-04-09 08:59:40 +02:00
|
|
|
|
2016-04-13 13:33:03 +02:00
|
|
|
## User
|
2016-04-21 18:59:44 +02:00
|
|
|
**Description**
|
|
|
|
|
|
|
|
A single user.
|
|
|
|
|
|
|
|
**Structure**
|
2016-04-09 08:59:40 +02:00
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
2016-04-21 18:59:44 +02:00
|
|
|
"name": <name>,
|
|
|
|
"email": <email>,
|
|
|
|
"rank": <rank>,
|
|
|
|
"rankName": <rank-name>,
|
|
|
|
"lastLoginTime": <last-login-time>,
|
|
|
|
"creationTime": <creation-time>,
|
|
|
|
"avatarStyle": <avatar-style>,
|
|
|
|
"avatarUrl": <avatar-url>
|
2016-04-09 08:59:40 +02:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2016-04-21 18:59:44 +02:00
|
|
|
**Field meaning**
|
|
|
|
- `<name>`: the user name.
|
|
|
|
- `<email>`: the user email. It is available only if the request is
|
|
|
|
authenticated by the same user.
|
|
|
|
- `<rank>`: the user rank, which effectively affects their privileges. The
|
|
|
|
available ranks are stored in the server configuration.
|
|
|
|
- `<rank-name>`: the text representation of user's rank. Like `<rank>`, the
|
|
|
|
possible values depend on the server configuration.
|
|
|
|
- `<last-login-time>`: the last login time, formatted as per RFC 3339.
|
|
|
|
- `<creation-time>`: the user registration time, formatted as per RFC 3339.
|
|
|
|
- `<avatarStyle>`: how to render the user avatar.
|
|
|
|
|
|
|
|
Possible values:
|
|
|
|
|
|
|
|
- `"gravatar"`: the user uses Gravatar.
|
|
|
|
- `"manual"`: the user has uploaded a picture manually.
|
|
|
|
|
|
|
|
- `<avatarUrl>`: the URL to the avatar.
|
|
|
|
|
2016-04-19 00:18:35 +02:00
|
|
|
## Tag category
|
2016-04-21 18:59:44 +02:00
|
|
|
**Description**
|
2016-04-19 00:18:35 +02:00
|
|
|
|
2016-04-21 18:59:44 +02:00
|
|
|
A single tag category. The primary purpose of tag categories is to distinguish
|
|
|
|
certain tag types (such as characters, media type etc.), which improves user
|
|
|
|
experience.
|
2016-04-20 11:15:36 +02:00
|
|
|
|
2016-04-21 18:59:44 +02:00
|
|
|
**Structure**
|
2016-04-20 11:15:36 +02:00
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
2016-04-21 18:59:44 +02:00
|
|
|
"name": <name>,
|
|
|
|
"color": <color>
|
2016-04-19 00:18:35 +02:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2016-04-21 18:59:44 +02:00
|
|
|
**Field meaning**
|
|
|
|
|
|
|
|
- `<name>`: the category name.
|
|
|
|
- `<color>`: the category color.
|
|
|
|
|
2016-04-15 23:02:30 +02:00
|
|
|
## Tag
|
2016-04-21 18:59:44 +02:00
|
|
|
**Description**
|
|
|
|
|
|
|
|
A single tag. Tags are used to let users search for posts.
|
|
|
|
|
|
|
|
**Structure**
|
2016-04-15 23:02:30 +02:00
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
2016-04-21 18:59:44 +02:00
|
|
|
"names": <names>,
|
|
|
|
"category": <category>,
|
|
|
|
"implications": <implications>,
|
|
|
|
"suggestions": <suggestions>,
|
|
|
|
"creationTime": <creation-time>,
|
|
|
|
"lastEditTime": <last-edit-time>
|
2016-04-15 23:02:30 +02:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2016-04-21 18:59:44 +02:00
|
|
|
**Field meaning**
|
|
|
|
|
|
|
|
- `<names>`: a list of tag names (aliases). Tagging a post with any name will
|
|
|
|
automatically assign the first name from this list.
|
|
|
|
- `<category>`: the name of the category the given tag belongs to.
|
|
|
|
- `<implications>`: a list of implied tag names. Implied tags are automatically
|
|
|
|
appended by the web client on usage.
|
|
|
|
- `<suggestions>`: a list of suggested tag names. Suggested tags are shown to
|
|
|
|
the user by the web client on usage.
|
|
|
|
- `<creation-time>`: time the tag was created, formatted as per RFC 3339.
|
2016-04-22 20:58:04 +02:00
|
|
|
- `<last-edit-time>`: time the tag was edited, formatted as per RFC 3339.
|
|
|
|
|
|
|
|
## Post
|
|
|
|
**Description**
|
|
|
|
|
|
|
|
One file together with its metadata posted to the site.
|
|
|
|
|
|
|
|
**Structure**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"id": <id>,
|
|
|
|
"safety": <safety>,
|
|
|
|
"type": <type>,
|
|
|
|
"checksum": <checksum>,
|
|
|
|
"source": <source>,
|
|
|
|
"canvasWidth": <canvas-width>,
|
|
|
|
"canvasHeight": <canvas-height>,
|
|
|
|
"flags": <flags>,
|
|
|
|
"tags": <tags>,
|
|
|
|
"relations": <relations>,
|
|
|
|
"creationTime": <creation-time>,
|
|
|
|
"lastEditTime": <last-edit-time>,
|
|
|
|
"user": <user>,
|
|
|
|
"score": <score>,
|
2016-04-24 16:34:06 +02:00
|
|
|
"ownScore": <own-score>,
|
2016-04-22 20:58:04 +02:00
|
|
|
"favoritedBy": <favorited-by>,
|
|
|
|
"featureCount": <feature-count>,
|
|
|
|
"lastFeatureTime": <last-feature-time>,
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
**Field meaning**
|
|
|
|
|
|
|
|
- `<id>`: the post identifier.
|
|
|
|
- `<safety>`: whether the post is safe for work.
|
|
|
|
|
|
|
|
Available values:
|
|
|
|
|
|
|
|
- `"safe"`
|
|
|
|
- `"sketchy"`
|
|
|
|
- `"unsafe"`
|
|
|
|
|
|
|
|
- `<type>`: the type of the post.
|
|
|
|
|
|
|
|
Available values:
|
|
|
|
|
|
|
|
- `"image"` - plain image.
|
|
|
|
- `"animation"` - animated image (GIF).
|
|
|
|
- `"video"` - WEBM video.
|
|
|
|
- `"flash"` - Flash animation / game.
|
|
|
|
- `"youtube"` - Youtube embed.
|
|
|
|
|
|
|
|
- `<checksum>`: the file checksum. Used in snapshots to signify changes of the
|
|
|
|
post content.
|
|
|
|
- `<source>`: where the post was grabbed form, supplied by the user.
|
|
|
|
- `<canvas-width>` and `<canvas-height>`: the original width and height of the
|
|
|
|
post content.
|
|
|
|
- `<flags>`: various flags such as whether the post is looped, represented as
|
|
|
|
array of plain strings.
|
|
|
|
- `<tags>`: list of tag names the post is tagged with.
|
|
|
|
- `<relations>`: a list of related post IDs. Links to related posts are shown
|
|
|
|
to the user by the web client.
|
|
|
|
- `<creation-time>`: time the tag was created, formatted as per RFC 3339.
|
|
|
|
- `<last-edit-time>`: time the tag was edited, formatted as per RFC 3339.
|
|
|
|
- `<user>`: who created the post, serialized as [user resource](#user).
|
2016-04-24 16:34:06 +02:00
|
|
|
- `<score>`: the collective score (+1/-1 rating) of the given post.
|
|
|
|
- `<own-score>`: the score (+1/-1 rating) of the given post by the
|
|
|
|
authenticated user.
|
2016-04-22 20:58:04 +02:00
|
|
|
- `<favorited-by>`: list of users, serialized as [user resources](#user).
|
|
|
|
- `<feature-count>`: how many times has the post been featured.
|
|
|
|
- `<last-feature-time>`: the last time the post was featured, formatted as per
|
|
|
|
RFC 3339.
|
2016-04-21 18:59:44 +02:00
|
|
|
|
2016-04-24 09:50:11 +02:00
|
|
|
## Comment
|
|
|
|
**Description**
|
|
|
|
|
|
|
|
A comment under a post.
|
|
|
|
|
|
|
|
**Structure**
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
2016-04-24 10:13:22 +02:00
|
|
|
"id": <id>,
|
2016-04-24 09:50:11 +02:00
|
|
|
"post": <post>,
|
|
|
|
"user": <author>
|
|
|
|
"text": <text>,
|
|
|
|
"creationTime": <creation-time>,
|
2016-04-24 16:34:06 +02:00
|
|
|
"lastEditTime": <last-edit-time>,
|
|
|
|
"score": <score>,
|
|
|
|
"ownScore": <own-score>
|
2016-04-24 09:50:11 +02:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
**Field meaning**
|
|
|
|
- `<id>`: the comment identifier.
|
|
|
|
- `<post>`: a post resource the post is linked with.
|
|
|
|
- `<author>`: a user resource the post is created by.
|
|
|
|
- `<creation-time>`: time the comment was created, formatted as per RFC 3339.
|
|
|
|
- `<last-edit-time>`: time the comment was edited, formatted as per RFC 3339.
|
2016-04-24 16:34:06 +02:00
|
|
|
- `<score>`: the collective score (+1/-1 rating) of the given comment.
|
|
|
|
- `<own-score>`: the score (+1/-1 rating) of the given comment by the
|
|
|
|
authenticated user.
|
2016-04-24 09:50:11 +02:00
|
|
|
|
|
|
|
|
2016-04-21 18:59:44 +02:00
|
|
|
## Snapshot
|
|
|
|
**Description**
|
|
|
|
|
|
|
|
A snapshot is a version of a database resource.
|
|
|
|
|
|
|
|
**Structure**
|
2016-04-20 11:15:36 +02:00
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
2016-04-21 18:59:44 +02:00
|
|
|
"operation": <operation>,
|
|
|
|
"type": <resource-type>
|
|
|
|
"id": <resource-id>,
|
|
|
|
"user": <user-name>,
|
|
|
|
"data": <data>,
|
|
|
|
"earlier-data": <earlier-data>,
|
|
|
|
"time": <time>
|
2016-04-20 11:15:36 +02:00
|
|
|
}
|
|
|
|
```
|
2016-04-16 17:03:28 +02:00
|
|
|
|
2016-04-21 18:59:44 +02:00
|
|
|
**Field meaning**
|
|
|
|
|
|
|
|
- `<operation>`: what happened to the resource.
|
|
|
|
|
|
|
|
The value can be either of values below:
|
|
|
|
|
|
|
|
- `"created"` - the resource has been created
|
|
|
|
- `"modified"` - the resource has been modified
|
|
|
|
- `"deleted"` - the resource has been deleted
|
|
|
|
|
|
|
|
- `<resource-type>` and `<resource-id>`: the resource that was changed.
|
|
|
|
|
|
|
|
The values are correlated as per table below:
|
|
|
|
|
|
|
|
| `<resource-type>` | `<resource-id>` |
|
|
|
|
| ----------------- | ------------------------------- |
|
|
|
|
| `"tag"` | first tag name at given time |
|
|
|
|
| `"tag_category"` | tag category name at given time |
|
|
|
|
| `"post"` | post ID |
|
|
|
|
|
|
|
|
- `<user-name>`: name of the user who has made the change.
|
|
|
|
|
|
|
|
- `<data>`: the snapshot data.
|
|
|
|
|
|
|
|
The value can be either of structures below:
|
|
|
|
|
|
|
|
- Tag category snapshot data (`<resource-type> = "tag"`)
|
|
|
|
|
|
|
|
*Example*
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"name": "character",
|
|
|
|
"color": "#FF0000"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
- Tag snapshot data (`<resource-type> = "tag"`)
|
|
|
|
|
|
|
|
*Example*
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"names": ["tag1", "tag2", "tag3"],
|
|
|
|
"category": "plain",
|
|
|
|
"implications": ["imp1", "imp2", "imp3"],
|
|
|
|
"suggestions": ["sug1", "sug2", "sug3"]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2016-04-22 20:58:04 +02:00
|
|
|
- Post snapshot data (`<resource-type> = "post"`)
|
|
|
|
|
|
|
|
*Example*
|
|
|
|
|
|
|
|
```json5
|
|
|
|
{
|
|
|
|
"source": "http://example.com/",
|
|
|
|
"safety": "safe",
|
|
|
|
"checksum": "deadbeef",
|
|
|
|
"tags": ["tag1", "tag2"],
|
|
|
|
"relations": [1, 2],
|
|
|
|
"notes": [{"polygon": [[1,1],[200,1],[200,200],[1,200]], "text": "..."}],
|
|
|
|
"flags": ["loop"],
|
|
|
|
"featured": false
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2016-04-21 18:59:44 +02:00
|
|
|
- `<earlier-data>`: `<data>` field from the last snapshot of the same resource.
|
|
|
|
This allows the client to create visual diffs for any given snapshot without
|
|
|
|
the need to know any other snapshots for a given resource.
|
|
|
|
|
|
|
|
- `<time>`: when the snapshot was created (i.e. when the resource was changed),
|
|
|
|
formatted as per RFC 3339.
|
|
|
|
|
2016-04-16 17:03:28 +02:00
|
|
|
|
2016-04-13 13:33:03 +02:00
|
|
|
# Search
|
2016-04-09 08:59:40 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
Search queries are built of tokens that are separated by spaces. Each token can
|
|
|
|
be of following form:
|
|
|
|
|
|
|
|
| Syntax | Token type | Description |
|
|
|
|
| ----------------- | ----------------- | ------------------------------------------ |
|
|
|
|
| `<value>` | anonymous tokens | basic filters |
|
|
|
|
| `<key>:<value>` | named tokens | advanced filters |
|
2016-04-22 19:37:58 +02:00
|
|
|
| `sort:<style>` | sort style tokens | sort the results |
|
2016-04-14 19:37:05 +02:00
|
|
|
| `special:<value>` | special tokens | filters usually tied to the logged in user |
|
|
|
|
|
|
|
|
Most of anonymous and named tokens support ranged and composite values that
|
|
|
|
take following form:
|
|
|
|
|
|
|
|
| `<value>` | Description |
|
|
|
|
| --------- | ----------------------------------------------------- |
|
|
|
|
| `a,b,c` | will show things that satisfy either `a`, `b` or `c`. |
|
|
|
|
| `1..` | will show things that are equal to or greater than 1. |
|
|
|
|
| `..4` | will show things that are equal to at most 4. |
|
|
|
|
| `1..4` | will show things that are equal to 1, 2, 3 or 4. |
|
|
|
|
|
2016-04-17 08:31:46 +02:00
|
|
|
Ranged values can be also supplied by appending `-min` or `-max` to the key,
|
|
|
|
for example like this: `score-min:1`.
|
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
Date/time values can be of following form:
|
2016-04-09 08:59:40 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
- `today`
|
|
|
|
- `yesterday`
|
|
|
|
- `<year>`
|
|
|
|
- `<year>-<month>`
|
|
|
|
- `<year>-<month>-<day>`
|
2016-04-09 08:59:40 +02:00
|
|
|
|
2016-04-14 20:16:05 +02:00
|
|
|
Some fields, such as user names, can take wildcards (`*`).
|
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
**Example**
|
2016-04-09 08:59:40 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
Searching for posts with following query:
|
2016-04-09 08:59:40 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
sea -fav-count:8.. type:swf uploader:Pirate
|
2016-04-09 08:59:40 +02:00
|
|
|
|
2016-04-14 19:37:05 +02:00
|
|
|
will show flash files tagged as sea, that were liked by seven people at most,
|
|
|
|
uploaded by user Pirate.
|