Example
cURL
curl \
-H 'authorization: Bearer YOUR_API_TOKEN' \
--data-urlencode 'description=Puppies are great!' \
'https://public-api.wordpress.com/rest/v1/sites/30434183/categories/slug:testing-category'
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 (
'description' => 'Puppies are great!',
)
),
),
);
$context = stream_context_create( $options );
$response = file_get_contents(
'https://public-api.wordpress.com/rest/v1/sites/30434183/categories/slug:testing-category',
false,
$context
);
$response = json_decode( $response );
?>
Response Body
{
"name": "testing category",
"slug": "testing-category",
"description": "Puppies are great!",
"post_count": 0,
"parent": 0,
"meta": {
"links": {
"self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/30434183\/categories\/testing-category",
"help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/30434183\/categories\/testing-category\/help",
"site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/30434183"
}
}
}