Edit
Table of Contents
- 1. Record field format
- 2. Associated attributes
- 3. Index
- 4. Show
- 5. Create
- 6. Update
- 7. Revert
- 8. See also
- 9. External links
This page has details for how to interact with post records through the API.
Record field format
| Name | Type | Details |
|---|---|---|
id | integer | >0 |
rating | string | includes [g, s, q, e] |
parent_id | integer or null | >0 |
source | string | |
md5 | string | Only shown if visible to the user. |
uploader_id | integer | >0 |
approver_id | integer or null | >0 |
file_ext | string | |
file_size | integer | |
image_width | integer | |
image_height | integer | |
score | integer | |
up_score | integer | |
down_score | integer | |
fav_count | integer | |
is_pending | boolean | |
is_flagged | boolean | |
is_deleted | boolean | |
tag_string | string | |
tag_count | integer | |
tag_count_general | integer | |
tag_count_artist | integer | |
tag_count_copyright | integer | |
tag_count_character | integer | |
tag_count_meta | integer | |
last_commented_at | timestamp or null | |
last_comment_bumped_at | timestamp or null | |
last_noted_at | timestamp or null | |
has_children | boolean | |
has_active_children | boolean | |
pixiv_id | integer or null | >0 |
bit_flags | bigint | |
created_at | timestamp | |
updated_at | timestamp |
Derived field format
These are values which are not part of the actual record, but instead are derived from calculations and record lookups on the fly.
| Name | Type | Details | Notes |
|---|---|---|---|
has_large | boolean | Derived from the media asset. The existence of the sample size. | |
has_visible_children | boolean | Derived from the children. Returns true if: - Any child is active - The user has it set to show deleted children - The post itself is deleted | |
file_url | string | Only shown if visible to user. | Derived from the media asset. The original size. |
large_file_url | string | Only shown if visible to user. | Derived from the media asset, if the sample size exists. |
preview_file_url | string | Only shown if visible to user. | Derived from the media asset. The 180x180 size. |
tag_string_general | string | Derived from the tag string. | |
tag_string_artist | string | Derived from the tag string. | |
tag_string_copyright | string | Derived from the tag string. | |
tag_string_character | string | Derived from the tag string. | |
tag_string_meta | string | Derived from the tag string. |
Associated attributes
The following is the list of relations that can be included in the API results (see Help:Common URL parameters for more info):
| Name | Type | Number | Availability | Details |
|---|---|---|---|---|
media_asset | media asset | single | required | Included by default. |
media_metadata | media metadata | single | required | |
uploader | user | single | required | |
approver | user | single | optional | |
parent | post | single | optional | |
children | post | multiple | optional | |
artist_commentary | artist_commentary | single | optional | |
notes | note | multiple | optional | |
comments | comment | multiple | optional | |
flags | post flag | multiple | optional | |
appeals | post appeals | multiple | optional | |
events | events | multiple | optional | |
approvals | post approval | multiple | optional | |
disapprovals | post disapproval | multiple | optional | |
replacements | post replacement | multiple | optional | |
ai_tags | ai tag | multiple | optional | |
dtext_links | dtext link | multiple | optional | |
embedding_wiki_pages | wiki page | multiple | optional |
Index
Returns multiple post records.
| HTTP Method | GET |
| Base URL | /posts.json |
| Type | read request |
| Description | The default order is ID descending |
Index parameters
tags- The post query to search for using tags and metatags (Help:Cheatsheet).random- Selects a random sampling under the post query.md5- Search for an MD5 match. Takes priority over all other parameters.
Search attributes
Search parameters are not available directly, but can be used via chaining (see Help:Chaining Syntax for more info). The following is an example of what this format can look like:
search[post][FIELD]=VALUE
The following are the base fields along with their associated type. Check the syntax pages for all of the available variations.
- Number syntax
idcreated_atupdated_atpixiv_idfav_countscoreup_scoredown_scorefile_sizeimage_widthimage_heighttag_countlast_comment_bumped_atlast_commented_atlast_noted_at- Text syntax
ratingsourcemd5file_ext- Boolean syntax
has_childrenhas_active_childrenis_pendingis_flaggedis_deletedis_banned- User syntax
uploaderapprover- Post syntax
parent(unavailable due to current limitations)children(unavailable due to current limitations)- Chaining syntax
artist_commentaryflagsappealsnotescommentsapprovalsreplacementsmedia_metadata
Special search parameters
The following are additional search fields.
tags- Behaves the same as the regular post search.
Show
Returns a single post record.
| HTTP Method | GET |
| Base URL | /posts/$id.json |
| Type | read request |
| Description | $id is the post ID |
Create
Creates a single post record.
| HTTP method | POST |
| Base URL | /posts.json |
| Type | write request |
Create parameters
Post parameters take the following format (see Help:API Write Requests for more info):
post[FIELD]=VALUE
- Mandatory:
upload_media_asset_id- Optional:
tag_stringratingparent_idsourceartist_commentary_titleartist_commentary_desctranslated_commentary_titletranslated_commentary_descis_pending- only matters for users with unrestricted uploads.
Update
Updates a single post record.
| HTTP Method | PUT/PATCH |
| Base URL | /posts/$id.json |
| Type | write request |
| Description | $id is the post ID |
Update parameters
- Optional:
tag_stringold_tag_stringparent_idold_parent_idsourceold_sourceratingold_ratinghas_embedded_notes
Destroy
Deletes a single post record.
| HTTP Method | DELETE |
| Base URL | /posts/$id.json |
| Type | write request |
| Description | $id is the post ID Only available to Approvers and above. |
Revert
| HTTP Method | PUT/PATCH |
| Base URL | /posts/$id/revert.json |
| Type | write request |
| Description | $id is the post ID |
Revert parameters
- Required:
- version_id - The post version ID to revert to.
See also
External links
No posts found.
