API: info.json
Use http://www.reddit.com/api/info.json?url=
to grab information about a URL's submissions on reddit.
Note: For the same data in XML, please see API: info.xml.
field | sample value | explanation |
---|---|---|
url |
https://github.com/reddit/reddit/ |
The URL of the page you are requesting information about. |
If the url
query string and its value are not present in the request, or if the page has never been submitted to reddit, the API will return something like the following:
{
"kind": "Listing",
"data": {
"modhash": "f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0",
"children": [],
"after": null,
"before": null
}
}
Otherwise, if the reddit_session
cookie is not present in the request, the API will return false
for saved
and hidden
, null
for likes
, and created
in UTC, but the rest of the information returned will be the same as if the user was logged in.
Otherwise, the API will return something like the following about the submissions with saved
, null
, and created
customized for the currently logged in user:
{
"kind": "Listing",
"data": {
"modhash": "f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0",
"children": [{
"kind": "t3",
"data": {
"domain": "blog.reddit.com",
"media_embed": {},
"levenshtein": null,
"subreddit": "blog",
"selftext_html": null,
"selftext": "",
"likes": true,
"saved": true,
"id": "i0jf9",
"clicked": false,
"author": "hueypriest",
"media": null,
"score": 1520,
"over_18": false,
"hidden": false,
"thumbnail": "http://thumbs.reddit.com/t3_i0jf9.png",
"subreddit_id": "t5_2qh49",
"downs": 2381,
"is_self": false,
"permalink": "/r/blog/comments/i0jf9/reddit_levels_up_with_three_new_programmers/",
"name": "t3_i0jf9",
"created": 1308164715.0,
"url": "http://blog.reddit.com/2011/06/reddit-levels-up-with-three-new.html",
"title": "reddit Levels Up with Three New Programmers",
"created_utc": 1308164715.0,
"num_comments": 533,
"ups": 3901
}
}, {
"kind": "t3",
"data": {
"domain": "blog.reddit.com",
"media_embed": {},
"levenshtein": null,
"subreddit": "ifyoulikeblank",
"selftext_html": null,
"selftext": "",
"likes": false,
"saved": false,
"id": "i0o2k",
"clicked": false,
"author": "warrrennnnn",
"media": null,
"score": 80,
"over_18": false,
"hidden": false,
"thumbnail": "http://thumbs.reddit.com/t3_i0o2k.png",
"subreddit_id": "t5_2sekf",
"downs": 5,
"is_self": false,
"permalink": "/r/ifyoulikeblank/comments/i0o2k/guess_which_awesome_new_subreddit_was_mentioned/",
"name": "t3_i0o2k",
"created": 1308174144.0,
"url": "http://blog.reddit.com/2011/06/reddit-levels-up-with-three-new.html",
"title": "Guess which \"awesome new subreddit\" was mentioned in the latest Reddit blogpost? r/ifyoulikeblank, you rock :D",
"created_utc": 1308174144.0,
"num_comments": 3,
"ups": 85
}
}],
"after": null,
"before": null
}
}
-
###kind (string)
The type of thing (see glossary on the API page) this is, which translates to Listing.
-
Holds relevant data about the URL
-
The page's modhash (see glossary on the API page) needed for voting and other API calls.
-
An array that holds an object for each post that was submitted for this URL, if any.
-
The type of thing (see glossary on the API page) this is, which translates to Link.
-
Holds relevant post data.
-
The domain of the page that was submitted, not including the protocol.
-
What is this for?
-
This is always null. Apparently, it was an experiment that got removed from everything but
jsontemplates
. -
The name of the subreddit this post was submitted to.
-
This would hold the HTML-formatted text of the post if this was a self post, but since
info.json
always serves information about link posts, it is always null. -
This would hold the plaintext of the post if this was a self post, but since
info.json
always serves information about link posts, it is always null. -
If the
reddit_session
cookie is not present in the request, the API will return null.Otherwise, this will indicate how the currently logged in user has voted the story:
true
for an up vote,false
for a down vote, ornull
for no vote. -
If the
reddit_session
cookie is not present in the request, the API will return false.Otherwise, this will indicate whether the currently logged in user has saved the story.
-
The link's id36 (see glossary on the API page). This is also used for short URLs (e.g. http://redd.it/6nw57) and toolbar URLs (e.g. http://www.reddit.com/tb/6nw57/).
-
Is this really always false?
-
The username of the user who submitted the post.
-
What is this for?
-
The current score (based on up votes minus down votes) of the post.
-
Says whether the post has been marked NSFW.
-
If the
reddit_session
cookie is not present in the request, the API will return false.Otherwise, this will indicate whether the currently logged in user has hidden the story.
-
thumbnail ([ string, enumerated string [
"/static/nsfw2.png"
,""
,"/static/noimage.png"
,"/static/self_default2.png"
] ])If the
reddit_session
cookie is present in the request and the post has been marked NSFW and the user does have the "make safe(r) for work" preference checked, the API will return"/static/nsfw2.png"
, which is 70px square.Otherwise, if the
reddit_session
cookie is not present in the request and the post has been marked NSFW, the API will return""
.Otherwise, if the post is a self post, the API will return
"/static/self_default2.png"
, which is 70px wide by 50px tall. However, sinceinfo.json
always serves information about link posts, it will never return this.Otherwise, if the post has no thumbnail, the API will return
"/static/noimage.png"
, which is 70px wide by 50px tall.Otherwise, the API will return a full URL to a thumbnail that is 70px wide.
-
This is the ID of the subreddit this post was submitted to. This is only used internally, right?
-
This is the number of down votes the post has gotten, according to reddit.
-
Says whether a post is a self post, but since
info.json
always serves information about link posts, it is always false. -
Holds a relative URL to the comments page for the post.
-
The FULLNAME (see glossary on the API page) of the post. It is also
kind
+_
+id
. -
If the
reddit_session
cookie is not present in the request, this is the unix time that the post was created in UTC.Otherwise, this is the unix time that the post was created in the currently logged in user's time zone?.
-
The full URL of the page the post is about, including protocol.
-
The title of the post, as written by the submitter of the post.
-
The number of comments the post currently has.
-
This is the number of up votes the post has gotten, according to reddit.
-
-
-
If not
null
, it is the FULLNAME (see glossary on the API page) of the post previous to the first one inchildren
if what the API returns is paginated. However,info.json
does not seem to paginate things, so the API will always returnnull
. -
###before ([null, string])
If not
null
, it is the FULLNAME (see glossary on the API page) of the post after the last one inchildren
if what the API returns is paginated. However,info.json
does not seem to paginate things, so the API will always returnnull
.
-