Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using the wordpress jetpack json api

I've installed the jetpack plugin for my self-hosted wordpress site. The JSON API feature in jetpack allows me to use the rest API (http://developer.wordpress.com/docs/api/). However i don't understand how to use it.

https://public-api.wordpress.com/rest/v1/sites/$site/posts/

How do i find my $site for example?

Any examples that anyone can share?

like image 261
Lord Vermillion Avatar asked Jun 08 '13 13:06

Lord Vermillion


2 Answers

Just replace $site with the URL of your site.

https://public-api.wordpress.com/rest/v1/sites/www.yoursite.com/posts/

like image 133
Alan Wong Avatar answered Oct 20 '22 03:10

Alan Wong


You can replace $site with the domain and (if needed) path of your selfhosted Wordpress site that has jetpack installed.

Just try this example where $site was replaced with discover.wordpress.com

https://public-api.wordpress.com/rest/v1.1/sites/discover.wordpress.com/posts/

If you get the error: {"error":"unauthorized","message":"API calls to this blog have been disabled."} with your own site make sure that you enabled the json api in the general section of your jetpack plugin settings.

enable json api for jetpack

like image 21
samy Avatar answered Oct 20 '22 02:10

samy