API dokumentáció (fejlesztőknek)

[GET] /api/getPostList/<source>/<sort>[/page]

Returns a post list. source can be all or a sub. sort must be one of hot, top or new.

Fields returned for each post found:

  • comments: the total count of comments for that post
  • content: the content of the post if it is a text post
  • downvotes: the number of downvotes in a post
  • edited: date/time when the post was last edited or null if the post was not edited
  • flair: the flair of the post or null if there is no flair
  • link: the post's link or null if it is a text post
  • nsfw: true if the post was marked as NSFW
  • pid: the post's unique ID
  • posted: date/time the post was posted
  • ptype: post type, currently 0 for text posts, 1 for link posts and 3 for polls
  • score: the sum of upvotes-downvoted
  • sub: the name of the sub the post belongs to
  • thumbnail: filename of the post's thumbnail
  • title: title of the post
  • uid: unique identifier for user
  • user: name of the user that created the post
  • upvotes: the number of upvotes in a post
Note: If an user's account is deleted, user will be [Deleted] and uid will be null.

Example response:
  {
    "posts": [
      {
        "comments": 1,
        "content": "dasdasd",
        "edited": null,
        "flair": null,
        "link": null,
        "nsfw": false,
        "pid": 13667,
        "posted": "Mon, 20 Nov 2017 04:40:00 GMT",
        "ptype": 0,
        "score": 1,
        "sub": "test",
        "thumbnail": "",
        "title": "Test post",
        "uid": "9dd8ec5e-4852-492a-a1ab-35eab6625280",
        "user": "Polsaker"
      },
      ....
    ],
      "status": "ok"
    }
    

[GET] /api/getPost/<pid>

Returns information for a post. pid is the post ID (integer).

Returns the same information as getPostList and a deleted field that is true if the post was deleted.

Note: If an user's account or the post is deleted, user will be [Deleted] and uid will be null.

[GET] /api/getPostComments/<pid>[/page]

Returns all the comments for a post as a list. pid is the post ID (integer).

Fields returned for each comment:

  • cid: unique comment id
  • content: the content of the comment
  • deleted: true only if the comment was deleted
  • lastedit: date/time of the last time the comment was edited or null if it was not.
  • parentcid: unique id for the parent comment or null if this is a comment directly on the post
  • posted: date/time when the comment was posted
  • score: comment's score
  • user: name of the user that created the comment or [Deleted] if the user or comment were deleted

Note: This query is paginated and will only return up to 50 comments per page.

[GET] /api/getComment/<cid>

Returns information for a comment. cid is the comment ID (uuid).

Returns the same information as getPostComments and a deleted field that is true if the comment was deleted.

Note: If an user's account or the comment is deleted, user will be [Deleted] and uid will be null.

[GET] /api/getPostComments/<pid>[/page]

Returns all the comments for a post as a list. pid is the post ID (integer).

Fields returned for each comment:

  • cid: unique comment id
  • content: the content of the comment
  • deleted: true only if the comment was deleted
  • lastedit: date/time of the last time the comment was edited or null if it was not.
  • parentcid: unique id for the parent comment or null if this is a comment directly on the post
  • posted: date/time when the comment was posted
  • score: comment's score
  • user: name of the user that created the comment or [Deleted] if the user or comment were deleted

Note: This query is paginated and will only return up to 50 comments per page.

[GET] /api/getUser/<username>

Returns profile information for username

Fields returned:

  • bot: true if the user is a bot
  • comment_count: Number of comments submitted
  • created: Account creation date/time
  • given: upvotes-downvotes given
  • downvotes_given: downvotes given
  • upvotes_given: upvotes given
  • level: User level
  • mods: List of subs that the user mods
  • name: User's name
  • owns: List of subs that the user owns
  • post_count: Number of posts submitted
  • score: upvoted-downvotes taken
  • xp: experience points (used to calculate level)

[GET] /api/getSub/<name>

Returns information for a sub. name is the sub's name.

Fields returned:

  • allow_polls: true if the sub allows polls.
  • created: date/time when the sub was created.
  • creator: username of the sub's creator or [Deleted] if the account was deleted.
  • default_sort: The sub's default sort. Either one of hot, top or new.
  • mods: A list with all the sub's mods minus the owner.
  • name: The sub's name
  • nsfw: true if the sub is NSFW.
  • owner: Name of the sub's current owner.
  • posts: Number of posts created in the sub.
  • restricted: true if only mods can post in the sub.
  • sidebar: The sub's sidebar text
  • subscribers: The number of users subscribed to the sub.
  • title: The sub's title.
  • user_can_flair: true if users can flair their own posts.
  • videomode: true if video mode is enabled.

[POST] /api/createPost

Creates a post. Requires an API token with the can_post permission.

Fields to be sent via POST:

  • ptype: Post type. Either text or link
  • sub: Sub name where the post will be created
  • title: Post title
  • link: (only if ptype is link) the post's link
  • content: (optional, only if ptype is text) the post's content
  • nsfw: set to 1 if the post is NSFW
  • token: API Token

Returns: The post's pid if successful.

[POST] /api/createComment

Creates a comment. Requires an API token with the can_post permission.

Fields to be sent via POST:

  • pid: Post id where the comment will be submitted to
  • parentcid: (optional) id of the parent comment
  • content: Comment content
  • token: API Token

Returns: The comment's cid if successful.