GET /sites/$site/posts/$post_ID/replies/

Return recent Comments for a Post

Resource URL

Type URL and Format
GET https://public-api.wordpress.com/rest/v1/sites/$site/posts/$post_ID/replies/

Method Parameters

Parameter Type Description
$site (int|string) The site ID, The site domain
$post_ID (int) The post ID

Query Parameters

Parameter Type Description
context (string)
display:
(default) Formats the output as HTML for display. Shortcodes are parsed, paragraph tags are added, etc..
edit:
Formats the output for editing. Shortcodes are left unparsed, significant whitespace is kept, etc..
http_envelope (bool)
false:
(default)
true:
Some environments (like in-browser Javascript or Flash) block or divert responses with a non-200 HTTP status code. Setting this parameter will force the HTTP status code to always be 200. The JSON response is wrapped in an "envelope" containing the "real" HTTP status code and headers.
pretty (bool)
false:
(default)
true:
Output pretty JSON
meta (string) Optional. Loads data from the endpoints found in the 'meta' part of the response. Comma separated list. Example: meta=site,likes
callback (string) An optional JSONP callback function.
number (int) The number of comments to return. Limit: 100. Default: 20.
offset (int) 0-indexed offset.
page (int) Return the Nth 1-indexed page of comments. Takes precedence over the offset parameter.
order (string)
DESC:
(default) Return comments in descending order from newest to oldest.
ASC:
Return comments in ascending order from oldest to newest.
after (iso 8601 datetime) Return comments dated on or after the specified datetime.
before (iso 8601 datetime) Return comments dated on or before the specified datetime.
type (string)
any:
(default) Return all comments regardless of type.
comment:
Return only regular comments.
trackback:
Return only trackbacks.
pingback:
Return only pingbacks.
pings:
Return both trackbacks and pingbacks.
status (string)
approved:
(default) Return only approved comments.
unapproved:
Return only comments in the moderation queue.
spam:
Return only comments marked as spam.
trash:
Return only comments in the trash.
all:
Return comments of all statuses.

Response Parameters

Parameter Type Description
found (int) The total number of comments found that match the request (ignoring limits, offsets, and pagination).
comments (array) An array of comment objects.

Example

cURL

curl 'https://public-api.wordpress.com/rest/v1/sites/en.blog.wordpress.com/posts/7/replies/?number=5&pretty=1'

PHP

<?php

$options  = array (
  'http' => 
  array (
    'ignore_errors' => true,
  ),
);

$context  = stream_context_create( $options );
$response = file_get_contents(
  'https://public-api.wordpress.com/rest/v1/sites/en.blog.wordpress.com/posts/7/replies/?number=5&pretty=1',
  false,
  $context
);
$response = json_decode( $response );

?>

Response Body

{
    "found": 8,
    "comments": [
        {
            "ID": 288,
            "post": {
                "ID": 7,
                "type": "post",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/7"
            },
            "author": {
                "ID": 3742,
                "email": false,
                "name": "Vashti",
                "nice_name": "vtymkin",
                "URL": "http:\/\/learningmorestuff.wordpress.com",
                "avatar_URL": "https:\/\/2.gravatar.com\/avatar\/b551bd04cc12ee09d2859e235d38a897?s=96&d=retro",
                "profile_URL": "http:\/\/en.gravatar.com\/vtymkin",
                "site_ID": 16437056
            },
            "date": "2005-12-13T03:40:15+00:00",
            "URL": "http:\/\/en.blog.wordpress.com\/2005\/09\/26\/blogging-and-stuff\/comment-page-1\/#comment-288",
            "short_URL": "http:\/\/wp.me\/pf2B5-7%23comment-288",
            "content": "<p>Super. Well done you guys! <span class='wp-smiley emoji emoji-tongue' title=':-P'>:-P<\/span><\/p>\n",
            "status": "approved",
            "parent": false,
            "type": "comment",
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/288",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/288\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
                    "post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/7",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/288\/replies\/"
                }
            }
        },
        {
            "ID": 283,
            "post": {
                "ID": 7,
                "type": "post",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/7"
            },
            "author": {
                "ID": 1488,
                "email": false,
                "name": "pipit",
                "nice_name": "pipit",
                "URL": "http:\/\/pipit.wordpress.com\/",
                "avatar_URL": "https:\/\/0.gravatar.com\/avatar\/c0c7c099bca74d2688895cacb388f434?s=96&d=retro",
                "profile_URL": "http:\/\/en.gravatar.com\/pipit",
                "site_ID": 1482
            },
            "date": "2005-12-12T08:24:58+00:00",
            "URL": "http:\/\/en.blog.wordpress.com\/2005\/09\/26\/blogging-and-stuff\/comment-page-1\/#comment-283",
            "short_URL": "http:\/\/wp.me\/pf2B5-7%23comment-283",
            "content": "<p>Where is it ?<br \/>\nIt that the reason you are not allow blog.wordpress.com <span class='wp-smiley emoji emoji-smile' title=':)'>:)<\/span><\/p>\n",
            "status": "approved",
            "parent": false,
            "type": "comment",
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/283",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/283\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
                    "post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/7",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/283\/replies\/"
                }
            }
        },
        {
            "ID": 279,
            "post": {
                "ID": 7,
                "type": "post",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/7"
            },
            "author": {
                "ID": 35259,
                "email": false,
                "name": "roz",
                "nice_name": "imroz",
                "URL": "http:\/\/www.rozedwards.co.uk",
                "avatar_URL": "https:\/\/2.gravatar.com\/avatar\/edf08a0f73b2b40096720d61f7919810?s=96&d=retro",
                "profile_URL": "http:\/\/en.gravatar.com\/imroz",
                "site_ID": 35518
            },
            "date": "2005-12-11T03:54:21+00:00",
            "URL": "http:\/\/en.blog.wordpress.com\/2005\/09\/26\/blogging-and-stuff\/comment-page-1\/#comment-279",
            "short_URL": "http:\/\/wp.me\/pf2B5-7%23comment-279",
            "content": "<p>We are the lucky ones! WordPress is great news.<\/p>\n",
            "status": "approved",
            "parent": false,
            "type": "comment",
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/279",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/279\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
                    "post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/7",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/279\/replies\/"
                }
            }
        },
        {
            "ID": 276,
            "post": {
                "ID": 7,
                "type": "post",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/7"
            },
            "author": {
                "ID": 5,
                "email": false,
                "name": "Matt",
                "nice_name": "matt",
                "URL": "http:\/\/matt.wordpress.com",
                "avatar_URL": "https:\/\/1.gravatar.com\/avatar\/767fc9c115a1b989744c755db47feb60?s=96&d=retro",
                "profile_URL": "http:\/\/en.gravatar.com\/matt",
                "site_ID": 4
            },
            "date": "2005-12-09T05:57:36+00:00",
            "URL": "http:\/\/en.blog.wordpress.com\/2005\/09\/26\/blogging-and-stuff\/comment-page-1\/#comment-276",
            "short_URL": "http:\/\/wp.me\/pf2B5-7%23comment-276",
            "content": "<p>Yep you guys found it.<\/p>\n",
            "status": "approved",
            "parent": false,
            "type": "comment",
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/276",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/276\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
                    "post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/7",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/276\/replies\/"
                }
            }
        },
        {
            "ID": 13,
            "post": {
                "ID": 7,
                "type": "post",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/7"
            },
            "author": {
                "ID": 219,
                "email": false,
                "name": "jtintle",
                "nice_name": "jtintle",
                "URL": "http:\/\/jtintle.wordpress.com\/",
                "avatar_URL": "https:\/\/2.gravatar.com\/avatar\/80f63a1f0b544d1aa25e5ec372ef0046?s=96&d=retro",
                "profile_URL": "http:\/\/en.gravatar.com\/jtintle",
                "site_ID": 217
            },
            "date": "2005-10-14T11:31:37+00:00",
            "URL": "http:\/\/en.blog.wordpress.com\/2005\/09\/26\/blogging-and-stuff\/comment-page-1\/#comment-13",
            "short_URL": "http:\/\/wp.me\/pf2B5-7%23comment-13",
            "content": "<p>WOW a secret blog&#8230;<\/p>\n",
            "status": "approved",
            "parent": false,
            "type": "comment",
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/13",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/13\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
                    "post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/7",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/13\/replies\/"
                }
            }
        }
    ]
}