Resource Information
Method | GET |
---|---|
URL | https://public-api.wordpress.com/rest/v1.1/me |
Requires authentication? | Yes |
Query Parameters
Parameter | Type | Description |
---|---|---|
http_envelope | (bool) |
|
pretty | (bool) |
|
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) | Optional. Returns specified fields only. Comma-separated list. Example: fields=ID,title |
callback | (string) | An optional JSONP callback function. |
abtests | (string) | Comma separated names of A/B tests the user may have an assigned variation for |
Response Parameters
Parameter | Type | Description |
---|---|---|
ID | (int) | Numeric user ID |
display_name | (string) | The name to display for a user |
username | (string) | Login name of a user |
(string) | Email address | |
primary_blog | (int) | ID of a user's primary blog |
primary_blog_url | (string) | URL to primary blog |
primary_blog_is_jetpack | (bool) | Is the primary blog a jetpack site |
language | (string) | User language setting |
locale_variant | (string) | User locale variant, if any |
token_site_id | (int) | ID of the user's site that the current token provides access to |
token_scope | (array) | Scopes that the current access token provides access to |
avatar_URL | (url) | Gravatar image URL |
profile_URL | (url) | Gravatar Profile URL |
verified | (bool) | Has the account been verified (via WordPress.com Connect)? |
email_verified | (bool) | Has the account been verified (via email)? |
date | (iso 8601 datetime) | Datetime the user joined WordPress.com |
site_count | (int) | Number of sites where the user is a member |
visible_site_count | (int) | Number of sites where the user is a member, set to visible in user settings |
has_unseen_notes | (bool) | Does the account have unseen notifications |
newest_note_type | (string) | notification type slug for newest unseen notification or blank if no unseen notes |
phone_account | (bool) | If this is a phone account then the user doenst have a verified email address |
meta | (object) | Metadata |
is_valid_google_apps_country | (bool) | Is the user somewhere where G Suite can be purchased? |
user_ip_country_code | (string) | Country code for the user’s IP address |
logout_URL | (url) | URL to sign user out of WordPress.com |
is_new_reader | (bool) | Is the user new to the Reader? |
social_login_connections | (array) | Array of active social login connections |
social_signup_service | (string) | The name of the social service this account is linked to |
abtests | (object) | User's assigned A/B test variations, where the key is the test name and the value is the variation |
Resource Errors
These are the possible errors returned by this endpoint.
HTTP Code | Error Identifier | Error Message |
---|---|---|
403 | authorization_required | An active access token must be used to query information about the current user. |
Example
curl \ -H 'authorization: Bearer YOUR_API_TOKEN' \ 'https://public-api.wordpress.com/rest/v1/me/'
<?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/me/', false, $context ); $response = json_decode( $response ); ?>
Response
{ "ID": 78972699, "display_name": "apiexamples", "username": "apiexamples", "email": "justin+apiexamples@a8c.com", "primary_blog": 82974409, "primary_blog_url": "http:\/\/apiexamples.wordpress.com", "primary_blog_is_jetpack": false, "language": "en", "locale_variant": "", "token_site_id": 82974409, "token_scope": [ "global" ], "avatar_URL": "https:\/\/1.gravatar.com\/avatar\/a2afb7b6c0e23e5d363d8612fb1bd5ad?s=96&d=identicon&r=G", "profile_URL": "http:\/\/en.gravatar.com\/apiexamples", "verified": true, "email_verified": true, "date": "2015-01-15T06:56:07+00:00", "site_count": 2, "visible_site_count": 2, "has_unseen_notes": true, "newest_note_type": "comment", "phone_account": false, "meta": { "links": { "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/me", "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/me\/help", "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/82974409", "flags": "https:\/\/public-api.wordpress.com\/rest\/v1\/me\/flags" } }, "is_valid_google_apps_country": true, "user_ip_country_code": "US", "social_login_connections": null, "social_signup_service": null, "abtests": {} }