GET /notifications/$note_ID

Get a Notification

Resource URL

Type URL and Format
GET https://public-api.wordpress.com/rest/v1/notifications/$note_ID

Method Parameters

Parameter Type Description
$note_ID (int) The note 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
fields (string) List of comma separated fields in the note object to return. Default: 'id,type,unread,noticon,body,subject,timestamp'.
callback (string) An optional JSONP callback function.
num_note_items (int) Number of items to include in notifications that contain multiple items Default: 9.

Response Parameters

Parameter Type Description
id (int) The note ID.
unread (int) Number of unread updates this note has had. 0 == note is read
noticon (string) The name of the icon that best fits this note
type (string) The type of the note. eg comment, likes, follows, etc
timestamp (int) The notes' last update time as a UNIX timestamp, GMT.
date (iso 8601 datetime) The notes' last update time in the user's timezone.
subject (string)
icon:
(string) Icon URL. 256x256 px, client can downsize
noticon:
(string) Noticon character. See Noticons Font: wordpress.com/i/noticons/example.html.
status:
(string) Text string describing the state of this notification. This is used to indicate things like "Replied", "Pending", etc for comments. By default displayed in brackets, but can be handled however a client wants on a per notification type basis.
html:
(html) The notification subject. Max of 200 visible chars.
text:
(string) Text of the notification subject. Max of 100 chars. No HTML. (iOS notification, etc)
snippet (string) Max 90 characters of text pulled from the subject of the notification - eg the comment content, or post content (optional)
body (string)
template:
single-line-list:
The notification body is a list of small items with attached actions. Fields: header, header_text, header_link, footer, footer_text, footer_link, items( icon, header, action ).
multi-line-list:
The notification body is a list of larger items with a single set of actions. Fields: header, footer, items( icon, header, html, action, objects ), actions.
big-badge:
The notification body is a large image or video with limited text. Fields: header, html, badge, objects.
header:
(html) header content of the body.
html:
(html) main content of the body.
badge:
(string) URL of Image or Video.
badge_width:
(int) Badge width.
badge_height:
(int) Badge height.
objects:
(object) Assoc Array of (possibly embedded) objects from the REST API. eg "/sites/1234" : false|object
items:
icon:
(string) Icon URL. 256x256px
icon_width:
(int) Icon width. deprecated
icon_height:
(int) Icon height. deprecated
header:
(html) Header for this item.
header_text:
(string) Header for this item.
header_link:
(string) Link for this item.
html:
(html) Body for this item.
action:
type:
(string) action type name.
params:
(array) key value pairs of parameters for performing the action.
objects:
(object) Assoc Array of (possibly embedded) objects associated with the item.from the REST API. eg "/sites/1234" : false|object
footer:
(html) Footer content of the body.
footer_text:
(string) Footer text.
footer_link:
(string) Footer link.
actions:
type:
(string) action type name.
params:
(array) key value pairs of parameters for the action.
status (string)
approval_status:
(string) WP comment_status field for the comment. (optional)
undo_status:
(int) 1 or 0 indicating whether the approval action can be undone (optional)
i_replied:
(boolean) Whether the current user has replied to the comment (optional)
meta (string)
ids:
(object) Key-value pairs with just the numeric id of each related object
links:
(object) Key-value pairs with URI to the endpoint for related object
data:
(object) Key-object pairs with the object from the associated endpoint
note (object) representation of a single notification

Example

cURL

curl \
 -H 'authorization: Bearer YOUR_API_TOKEN' \
 'https://public-api.wordpress.com/rest/v1/notifications/1/?pretty=1'

PHP

<?php

$options  = array (
  'http' => 
  array (
    'ignore_errors' => true,
    'header' => 
    array (
      0 => 'authorization: Bearer YOUR_API_TOKEN',
    ),
  ),
);

$context  = stream_context_create( $options );
$response = file_get_contents(
  'https://public-api.wordpress.com/rest/v1/notifications/1/?pretty=1',
  false,
  $context
);
$response = json_decode( $response );

?>

Response Body

{
    "error": "authorization_required",
    "message": "An active access token must be used retrieve notifications."
}