News - May 01, 2013 (18 days ago)

RULE UPDATE: Please consult the following thread for an important update, effective immediately, to the site's "Tag What You See" rule: http://e621.net/forum/show/67138

Site Update: We've temporarily disabled the tag sidebar on the post index (when searching) since it seems to be the cause of the performance problem. It'll be back soon once we fix or rewrite it.

A reminder: When flagging a post for deletion (except if its for DNP or against posting rules), please make sure it has a parent for the favorites to be transferred to. Information on how to flag is here and information on how to parent can be found here

X

API: how to get comments for a post?

In category: General

I've been working on a mobile app using the JSON API, but I've hit a snag. How do you get the comments for a post? I can get a comment by ID, but posts only have a "has_comments" field - how do I know which comment IDs correspond to which posts?


http://e621.net/comment/index.json?post_id=70000

Replace 70000 with whatever post ID you need, of course, and keep in mind that the last comment on the site is the first comment in that response, so flip them around to get them in the right order.


Thanks, that works.

Another question: when I specify a page number and some tags to list posts, how do I find how many pages there are?


I don't believe you can. Even e621's own pagination doesn't go past something like 100 pages, though I forget whether that is the exact upper limit. But either way, after a certain number of pages, e621 starts offering pages based on post ID instead of "page number."


Unfortunately it looks like you can't when using JSON, but you can using XML. XML's root element (posts) has a 'count' attribute, which is the total number of posts returned by the search, and an 'offset' attribute showing how many posts are before the first one (so if you requested page 2, 75 posts per page, the offset will be 75).


Here's another one (this thread just won't die!): how to get the reason a post is flagged for deletion?

Thanks for all the help btw.


ikdind said:
I don't believe you can. Even e621's own pagination doesn't go past something like 100 pages, though I forget whether that is the exact upper limit. But either way, after a certain number of pages, e621 starts offering pages based on post ID instead of "page number."

1000 pages, hard coded. at that point in time we start to hit ruby's scaling issues with pagination and gotta play magic numbers, it still works well though.

Falord
Contributor
7 months ago
2012 balloons english_text equine female feral friendship_is_magic frown hair horse kinglyms long_hair looking_at_viewer my_little_pony pink_fur pink_hair pinkamena_(mlp) pinkie_pie_(mlp) pony portrait red_eyes solo text rating:Safe score:18 user:anthroking

Well since this topic is almost like what I want to ask. Why doesn't Delete post that has delete because a better version has been posted comments crossover to the new version?


Falord said:
Well since this topic is almost like what I want to ask. Why doesn't Delete post that has delete because a better version has been posted comments crossover to the new version?

... I don't what... what is.. huh?

Falord
Contributor
7 months ago
2012 balloons english_text equine female feral friendship_is_magic frown hair horse kinglyms long_hair looking_at_viewer my_little_pony pink_fur pink_hair pinkamena_(mlp) pinkie_pie_(mlp) pony portrait red_eyes solo text rating:Safe score:18 user:anthroking

Aurali said:
... I don't what... what is.. huh?

... all I meant was the comment for deleted post go over to new posts of the same image...


Because then the comments might not make sense on the new post. If a bunch of people point out that post X is a smaller version of Y, and those comments get moved to post Y, then all of a sudden you have a bunch of comments saying that post Y is too small, which is wrong.