user2654336
user2654336

Reputation:

What is the children parameter in the Reddit API?

I am trying to get a list of comments from a specific story with the Reddit API.

I am using the API call POST api/morechildren and do not know what to put for the children parameter. The documentation says it has to be "a comma-delimited list of comment IDs". I am not sure what the comment IDs look like, is there anyone that knows what this is? If so, please provide an example…

Upvotes: 2

Views: 873

Answers (1)

bboe
bboe

Reputation: 4412

I am not sure what the comment IDs look like, is there anyone that knows what this is?

A comment id looks like t1_BASE36ID. The BASE36ID is the value listed under children in the submission response. For example if you fetch the URL http://www.reddit.com/r/redditdev/comments/w60cs/using_morechildren_without_praw/.json?limit=2 part of the json response is:

kind: "Listing",
data: {
  modhash: "reswq423o8daa6014e3fbf914e0572a5fe6c17a66b599e0671",
  children: [
    {
      kind: "more",
      data: {
        count: 9,
        parent_id: "t1_c5akqs1",
        children: [
          "c5anb3r",
          "c5b9z4g"
        ],
        name: "t1_c5anb3r",
        id: "c5anb3r"
      }
    }
  ],
  after: null,
  before: null
}

You will want to convert that list of children BASE36IDs into t1_c5anb3r,t1_c5b9z4g.

Upvotes: 3

Related Questions