Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Leveraging WordPress REST API to power Mobile Apps

Avatar for mahlamusa mahlamusa
November 01, 2018

Leveraging WordPress REST API to power Mobile Apps

Example of how we can use the WordPress REST API to power mobile applications. Download the GitHub repository to see example code: https://github.com/mahlamusa/wp-rest-api-powered-app

Avatar for mahlamusa

mahlamusa

November 01, 2018
Tweet

Other Decks in Programming

Transcript

  1. What is WP REST API • It is an easy

    to use REST API built on top of WordPress to allow you to access and manipulate WordPress data types.
  2. Why use WP REST API? • It allows us to

    use WordPress in new ways • Access data without direct access to database or user interface • No need to know the underlying code • Use any programming language of your choice • No limit to what you can build
  3. Getting started: Environment • Install Node.js: https://nodejs.org/en/download/ • Install Ionic

    Framework: https://ionicframework.com/getting-started#cli • Install WordPress: https://github.com/WP-API/Basic-Auth • Github: https://github.com/mahlamusa/wp-rest-api-powered-app
  4. Key concepts • Route – URI mapped to HTTP methods

    known as Endpoints • Request – Asking the server for some data or to perform action. Sent remotely or internally • Response – Received from the server to fullfil a Request • Schema – data structures expected or returned by endpoints • Rest field - a single property of an object
  5. Data type available • /pages • /posts • /posts/<post_id>/revisions •

    /categories • /taxonomies • /comments • /users • /media • /{post_types} • /statuses/<status> • /settings
  6. What we will do • Retrieve existing data • Update

    existing data • Add custom rest route/endpoints • Add fields to existing endpoints
  7. Now we code Image Source: https://sites.google.com/a/somers.k12.ct.us/clark_leiphart-homepage/keyboarding-games For the code used,

    please refer to the github repository: https://github.com/mahlamusa/wp-rest-api-powered-app The code will be updated from time to time.