WP-API

 

An Introduction to v2

 

@JS_Zao

WP-API

 

Installing WP-API

 

$ git clone https://github.com/WP-API/WP-API.git

WP-API

 

Using WP-API

 

/wp-json/wp/v2/posts

WP-API

 

Using WP-API

 

WP-API

 

Using WP-API

 

add_filter( 'rest_url_prefix', function( $prefix ) {
    return 'api';
} );

WP-API

 

Using WP-API

 

add_filter( 'rest_url_prefix', function( $prefix ) {
    return 'api';
} );
/api

WP-API

 

Using WP-API

 

add_filter( 'rest_url_prefix', function( $prefix ) {
    return 'api';
} );
/api/wp

WP-API

 

Using WP-API

 

add_filter( 'rest_url_prefix', function( $prefix ) {
    return 'api';
} );
/api/wp/v2

WP-API

 

Using WP-API

 

add_filter( 'rest_url_prefix', function( $prefix ) {
    return 'api';
} );
/api/wp/v2/{resource}

WP-API

 

 

add_filter( 'rest_url_prefix', function( $prefix ) {
    return 'api';
} );
       ENVR

WP-API

 

Using WP-API...or not.

 

add_filter( 'rest_enabled', '__return_false' );

WP-API

 

Understanding WP-API

Glossary of Terms

 

  • Namespace

WP-API

 

Understanding WP-API

Glossary of Terms

 

  • Namespace
  • Entity

WP-API

 

Understanding WP-API

Glossary of Terms

 

  • Namespace
  • Entity
  • Collection

WP-API

 

Understanding WP-API

Glossary of Terms

 

  • Namespace
  • Entity
  • Collection
  • Server

WP-API

 

Understanding WP-API

Glossary of Terms

 

  • Controller

WP-API

 

Understanding WP-API

Glossary of Terms

 

  • Controller
  • Request

WP-API

 

Understanding WP-API

Glossary of Terms

 

  • Controller
  • Request
  • Response

WP-API

 

Understanding WP-API

Glossary of Terms

 

  • Controller
  • Request
  • Response
  • Route

WP-API

 

Understanding WP-API

Glossary of Terms

 

  • Controller
  • Request
  • Response
  • Route
  • Envelope

WP-API

 

Understanding WP-API

Glossary of Terms

 

  • Controller
  • Request
  • Response
  • Route
  • Envelope
  • Schema

WP-API

Console Time!

Resources

  • github.com/WP-API/WP-API
  • #core-restapi
  • wp-api.org
  • https://www.youtube.com/watch?v=DyTeLjsopC4
  • https://poststatus.com/wordpress-json-rest-api/
  • https://speakerdeck.com/rachelbaker/utilizing-the-wp-rest-api
  • http://torquemag.io/introduction-wordpress-new-universal-connector-json-rest-api/
  • http://v2.wp-api.org/extending/internal-classes/

 

Resources

  • https://make.wordpress.org/core/tag/json-api/

WP-API

 

@JS_Zao

Made with Slides.com