PHP
<?php
$options = array (
'http' =>
array (
'ignore_errors' => true,
'method' => 'POST',
'header' =>
array (
0 => 'authorization: Bearer YOUR_API_TOKEN',
1 => 'Content-Type: application/x-www-form-urlencoded',
),
'content' => http_build_query(
array (
'content' => 'Your reply is very interesting. This is a reply.',
)
),
),
);
$context = stream_context_create( $options );
$response = file_get_contents(
'https://public-api.wordpress.com/rest/v1/sites/30434183/posts/1222/replies/new/',
false,
$context
);
$response = json_decode( $response );
?>
Response Body
{
"ID": 9,
"post": {
"ID": 1222,
"type": "post",
"link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/30434183\/posts\/1222"
},
"author": {
"ID": 18342963,
"email": false,
"name": "binarysmash",
"URL": "http:\/\/binarysmash.wordpress.com",
"avatar_URL": "http:\/\/0.gravatar.com\/avatar\/a178ebb1731d432338e6bb0158720fcc?s=96&d=identicon&r=G",
"profile_URL": "http:\/\/en.gravatar.com\/binarysmash"
},
"date": "2012-04-11T18:09:41+00:00",
"URL": "http:\/\/opossumapi.wordpress.com\/2012\/04\/11\/hello-world-2\/#comment-9",
"short_URL": "http:\/\/wp.me\/p23HjV-jI%23comment-9",
"content": "<p>Your reply is very interesting. This is a reply.<\/p>\n",
"status": "approved",
"parent": {
"ID":8,
"type": "comment",
"link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/30434183\/comments\/8"
},
"type": "comment",
"meta": {
"links": {
"self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/30434183\/comments\/9",
"help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/30434183\/comments\/9\/help",
"site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/30434183",
"post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/30434183\/posts\/1222",
"replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/30434183\/comments\/9\/replies\/"
}
}
}