GET /sites/$site/posts/$post_ID/likes/

List the Likes for a Post

Resource URL

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

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
http_envelope (bool)
false:
(default)
true:
Some enviroments (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
callback (string) An optional JSONP callback function.

Response Parameters

Parameter Type Description
found (int) The total number of likes for this post.
i_like (bool) If authenticated, this returns the current like status for the user on this post.
likes (array) An array of users who liked this post.

Example

cURL

curl 'https://public-api.wordpress.com/rest/v1/sites/en.blog.wordpress.com/posts/7/likes/?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/likes/?pretty=1',
  false,
  $context
);
$response = json_decode( $response );

?>

Response Body

{
    "found": 6,
    "i_like": false,
    "likes": [
        {
            "ID": 3251794,
            "email": false,
            "name": "Ian Stewart",
            "URL": "http:\/\/iandanielstewart.com\/",
            "avatar_URL": "http:\/\/0.gravatar.com\/avatar\/384c0fcf18524b1f0e628c6924f0e2af?s=96&d=retro",
            "profile_URL": "http:\/\/en.gravatar.com\/themeshaper",
            "default_avatar": false
        },
        {
            "ID": 13295956,
            "email": false,
            "name": "Armando Netto \/armandrops",
            "URL": "http:\/\/ahnem.wordpress.com",
            "avatar_URL": "http:\/\/2.gravatar.com\/avatar\/eaade0a0154c88dfa258a794d9353927?s=96&d=retro",
            "profile_URL": "http:\/\/en.gravatar.com\/armandonetto",
            "default_avatar": false
        },
        {
            "ID": 13448580,
            "email": false,
            "name": "Lusy Aaltje",
            "URL": "http:\/\/www.thesunsetgirl.com\/",
            "avatar_URL": "http:\/\/2.gravatar.com\/avatar\/8f3b5998c48565beb1425d01575533cb?s=96&d=retro",
            "profile_URL": "http:\/\/en.gravatar.com\/lusysunsetgirl",
            "default_avatar": false
        },
        {
            "ID": 16428369,
            "email": false,
            "name": "Gaurav Tiwari",
            "URL": "http:\/\/gauravtiwari.org",
            "avatar_URL": "http:\/\/1.gravatar.com\/avatar\/d43e061c1544ee88f99ce6df1638f3ed?s=96&d=retro",
            "profile_URL": "http:\/\/en.gravatar.com\/wpgaurav",
            "default_avatar": false
        },
        {
            "ID": 23712211,
            "email": false,
            "name": "Chris",
            "URL": "http:\/\/gunky.org",
            "avatar_URL": "http:\/\/0.gravatar.com\/avatar\/6ab996945f1fd6ea80a33e0ce491d819?s=96&d=retro",
            "profile_URL": "http:\/\/en.gravatar.com\/chrisrudzki",
            "default_avatar": false
        },
        {
            "ID": 31726643,
            "email": false,
            "name": "timelessheart",
            "URL": "http:\/\/timelessheart.wordpress.com",
            "avatar_URL": "http:\/\/2.gravatar.com\/avatar\/b5f74c4fd2d377538c210b176268e741?s=96&d=retro",
            "profile_URL": "http:\/\/en.gravatar.com\/timelessheart",
            "default_avatar": true
        }
    ]
}