Resource Information
Method
GET
URL
https://public-api.wordpress.com/rest/v1.1/me/publicize-connections/
Requires authentication?
Yes
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)
Optional. Returns specified fields only. Comma-separated list. Example: fields=ID,title
callback
(string)
An optional JSONP callback function.
service
(string)
Optional. Only return connections for the given services.
keyring_connection_ID
(int)
Optional. Only return connections for the given keyring connection ID.
site
(string)
Optional. Only return connections for the given site that the user can publicize to. Includes global connections owned by other users on the site.
Response Parameters
Parameter
Type
Description
connections
(array)
List of publicize connections. See /me/publicize-connections/%d for individual connection descriptions.
Resource Errors
These are the possible errors returned by this endpoint.
HTTP Code
Error Identifier
Error Message
400
deletion_error
This connection could not be deleted.
403
authorization_required
This user is not authorized to access publicize connections on this site.
400
invalid_input
Please provide at least one property to update for this connection
400
incompatible_jetpack
Please upgrade Jetpack to version 3.3 or newer in order to access this endpoint.
403
authorization_required
This user is not authorized to globalize this publicize connection.
400
missing_jetpack_module
The Publicize module must be activated in order to use this endpoint.
400
insert_error
This connection could not be updated.
400
publicize_disabled
Publicize is disabled on this blog.
404
not_found
No publicize connection found for this ID
403
authorization_required
This user is not authorized to access this publicize connection.
Example
curl \
-H 'authorization: Bearer YOUR_API_TOKEN' \
'https://public-api.wordpress.com/rest/v1.1/me/publicize-connections/'
<?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.1/me/publicize-connections/',
false,
$context
);
$response = json_decode( $response );
?>
Response
{
"connections": [
{
"ID": 1234567,
"site_ID": 3584907,
"user_ID": 12345678,
"keyring_connection_ID": 1234567,
"keyring_connection_user_ID": 12345678,
"shared": false,
"service": "twitter",
"label": "Twitter",
"issued": "2014-08-23 02:49:47",
"expires": "0000-00-00 00:00:00",
"external_ID": "15919116",
"external_name": "Automattic",
"external_display": "@automattic",
"external_profile_picture": "https:\/\/pbs.twimg.com\/profile_images\/453860857923923968\/Rg_FuLjK_400x400.png",
"external_profile_URL": "http:\/\/twitter.com\/automattic",
"external_follower_count": 24103,
"status": "ok",
"refresh_URL": "https:\/\/public-api.wordpress.com\/connect\/?action=request&kr_nonce=xxxxxxxxxx&nonce=xxxxxxxxxx&refresh=1&for=connect&service=twitter&kr_blog_nonce=xxxxxxxxxx&magic=keyring&blog=3584907",
"meta": {
"links": {
"self": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/3584907\/publicize-connections\/1234567",
"help": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/3584907\/publicize-connections\/1234567\/help",
"site": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/3584907",
"service": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/meta\/external-services\/twitter",
"keyring-connection": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/me\/keyring-connections\/1234567"
}
}
}
]
}