Getting Sponsers Information Using WP-API on WordCamp.org
In wordcamp.org, we can use WP REST API. So, I try to get some information. Getting Sponsers Information use q […]
目次
In wordcamp.org, we can use WP REST API.
So, I try to get some information.
Getting Sponsers Information
use query “wcb_sponsor”.
But you can not use ?filter[XXX]= & ?type=wcb_sponsor.
Example: Get Sponser Information on WordCamp US 2015
$curl -l https://2015.us.wordcamp.org/wp-json/posts?type=wcb_sponsor
[js]
$ curl -l https://2015.us.wordcamp.org/wp-json/posts?type=wcb_sponsor | jq ".[0]"
{
"ID": 10067,
"title": "Photobot -3000-",
"status": "publish",
"type": "wcb_sponsor",
"author": {
"ID": 385876,
"username": "kcristiano",
"name": "Kevin Cristiano",
"first_name": "Kevin",
"last_name": "Cristiano",
"nickname": "kcristiano",
"slug": "kcristiano",
"URL": "https://tadpole.cc",
"avatar": "https://secure.gravatar.com/avatar/365c9b6e2477fa5daec3be6db05c8f57?s=96",
"description": "",
"registered": "2008-03-08T03:46:28+00:00",
"meta": {
"links": {
"self": "https://2015.us.wordcamp.org/wp-json/users/385876",
"archives": "https://2015.us.wordcamp.org/wp-json/users/385876/posts"
}
}
},
"content": "",
"parent": null,
"link": "https://2015.us.wordcamp.org/sponsor/photobot-3000/",
"date": "2015-12-06T08:57:39",
"modified": "2015-12-06T08:57:39",
"format": "standard",
"slug": "photobot-3000",
"guid": "https://2015.us.wordcamp.org/?post_type=wcb_sponsor&p=10067",
"excerpt": null,
"menu_order": 0,
"comment_status": "closed",
"ping_status": "closed",
"sticky": false,
"date_tz": "America/New_York",
"date_gmt": "2015-12-06T13:57:39",
"modified_tz": "America/New_York",
"modified_gmt": "2015-12-06T13:57:39",
"meta": {
"links": {
"self": "https://2015.us.wordcamp.org/wp-json/posts/10067",
"author": "https://2015.us.wordcamp.org/wp-json/users/385876",
"collection": "https://2015.us.wordcamp.org/wp-json/posts",
"replies": "https://2015.us.wordcamp.org/wp-json/posts/10067/comments",
"version-history": "https://2015.us.wordcamp.org/wp-json/posts/10067/revisions"
}
},
"terms": {
"wcb_sponsor_level": [
{
"ID": 11,
"name": "In-Kind",
"slug": "in-kind",
"description": "",
"taxonomy": "wcb_sponsor_level",
"parent": null,
"count": 3,
"link": "https://2015.us.wordcamp.org/sponsor_level/in-kind/",
"meta": {
"links": {
"collection": "https://2015.us.wordcamp.org/wp-json/taxonomies/wcb_sponsor_level/terms",
"self": "https://2015.us.wordcamp.org/wp-json/taxonomies/wcb_sponsor_level/terms/5542"
}
}
}
]
},
"post_meta": [
{
"ID": 102949,
"key": "_wcpt_sponsor_website",
"value": "https://photobot3000.com/"
}
]
}
[/js]
Example2: Getting Sponser Levels on WordCamp Paris 2016
[js]
$ curl -l https://paris.wordcamp.org/2016/wp-json/posts?type=wcb_sponsor | jq ".[].terms.wcb_sponsor_level"
[
{
"ID": 55,
"name": "Argent",
"slug": "argent",
"description": "",
"taxonomy": "wcb_sponsor_level",
"parent": null,
"count": 3,
"link": "https://paris.wordcamp.org/2016/sponsor_level/argent/",
"meta": {
"links": {
"collection": "https://paris.wordcamp.org/2016/wp-json/taxonomies/wcb_sponsor_level/terms",
"self": "https://paris.wordcamp.org/2016/wp-json/taxonomies/wcb_sponsor_level/terms/4327"
}
}
}
]
[
{
"ID": 56,
"name": "Bronze",
"slug": "bronze",
"description": "",
"taxonomy": "wcb_sponsor_level",
"parent": null,
"count": 3,
"link": "https://paris.wordcamp.org/2016/sponsor_level/bronze/",
"meta": {
"links": {
"collection": "https://paris.wordcamp.org/2016/wp-json/taxonomies/wcb_sponsor_level/terms",
"self": "https://paris.wordcamp.org/2016/wp-json/taxonomies/wcb_sponsor_level/terms/4035"
}
}
}
]
[
{
"ID": 54,
"name": "Or",
"slug": "or",
"description": "",
"taxonomy": "wcb_sponsor_level",
"parent": null,
"count": 1,
"link": "https://paris.wordcamp.org/2016/sponsor_level/or/",
"meta": {
"links": {
"collection": "https://paris.wordcamp.org/2016/wp-json/taxonomies/wcb_sponsor_level/terms",
"self": "https://paris.wordcamp.org/2016/wp-json/taxonomies/wcb_sponsor_level/terms/4326"
}
}
}
]
[
{
"ID": 56,
"name": "Bronze",
"slug": "bronze",
"description": "",
"taxonomy": "wcb_sponsor_level",
"parent": null,
"count": 3,
"link": "https://paris.wordcamp.org/2016/sponsor_level/bronze/",
"meta": {
"links": {
"collection": "https://paris.wordcamp.org/2016/wp-json/taxonomies/wcb_sponsor_level/terms",
"self": "https://paris.wordcamp.org/2016/wp-json/taxonomies/wcb_sponsor_level/terms/4035"
}
}
}
]
[
{
"ID": 55,
"name": "Argent",
"slug": "argent",
"description": "",
"taxonomy": "wcb_sponsor_level",
"parent": null,
"count": 3,
"link": "https://paris.wordcamp.org/2016/sponsor_level/argent/",
"meta": {
"links": {
"collection": "https://paris.wordcamp.org/2016/wp-json/taxonomies/wcb_sponsor_level/terms",
"self": "https://paris.wordcamp.org/2016/wp-json/taxonomies/wcb_sponsor_level/terms/4327"
}
}
}
]
[
{
"ID": 53,
"name": "Platine",
"slug": "platine",
"description": "",
"taxonomy": "wcb_sponsor_level",
"parent": null,
"count": 2,
"link": "https://paris.wordcamp.org/2016/sponsor_level/platine/",
"meta": {
"links": {
"collection": "https://paris.wordcamp.org/2016/wp-json/taxonomies/wcb_sponsor_level/terms",
"self": "https://paris.wordcamp.org/2016/wp-json/taxonomies/wcb_sponsor_level/terms/213842"
}
}
}
]
[
{
"ID": 55,
"name": "Argent",
"slug": "argent",
"description": "",
"taxonomy": "wcb_sponsor_level",
"parent": null,
"count": 3,
"link": "https://paris.wordcamp.org/2016/sponsor_level/argent/",
"meta": {
"links": {
"collection": "https://paris.wordcamp.org/2016/wp-json/taxonomies/wcb_sponsor_level/terms",
"self": "https://paris.wordcamp.org/2016/wp-json/taxonomies/wcb_sponsor_level/terms/4327"
}
}
}
]
[
{
"ID": 56,
"name": "Bronze",
"slug": "bronze",
"description": "",
"taxonomy": "wcb_sponsor_level",
"parent": null,
"count": 3,
"link": "https://paris.wordcamp.org/2016/sponsor_level/bronze/",
"meta": {
"links": {
"collection": "https://paris.wordcamp.org/2016/wp-json/taxonomies/wcb_sponsor_level/terms",
"self": "https://paris.wordcamp.org/2016/wp-json/taxonomies/wcb_sponsor_level/terms/4035"
}
}
}
]
[
{
"ID": 53,
"name": "Platine",
"slug": "platine",
"description": "",
"taxonomy": "wcb_sponsor_level",
"parent": null,
"count": 2,
"link": "https://paris.wordcamp.org/2016/sponsor_level/platine/",
"meta": {
"links": {
"collection": "https://paris.wordcamp.org/2016/wp-json/taxonomies/wcb_sponsor_level/terms",
"self": "https://paris.wordcamp.org/2016/wp-json/taxonomies/wcb_sponsor_level/terms/213842"
}
}
}
]
[
{
"ID": 4,
"name": "Splendid Sponsor",
"slug": "splendid",
"description": "",
"taxonomy": "wcb_sponsor_level",
"parent": null,
"count": 1,
"link": "https://paris.wordcamp.org/2016/sponsor_level/splendid/",
"meta": {
"links": {
"collection": "https://paris.wordcamp.org/2016/wp-json/taxonomies/wcb_sponsor_level/terms",
"self": "https://paris.wordcamp.org/2016/wp-json/taxonomies/wcb_sponsor_level/terms/497030"
}
}
}
]
[/js]
Using for Development Enviroment
If you want to use on WordPress Meta Environment
You should install WP API plugin yourself.
Warning:Check Version.
WordCamp.org using WP API v1.
you should install “WP REST API (WP API)”, NOT “WordPress REST API (Version 2)”.
Using WP-CLI
[bash]
$ vagrant ssh
$ cd /vagrant/www/wordpress-meta-environment/wordcamp.dev/public_html/wordpress
$ wp plugin install json-rest-api –activate
[/bash]