woocommerce & apple tv
TRANSCRIPT
5CODEKITCHEN
A different focusthen I wanted
WordCamp Norway 2012
Talked about integrating apps
WordPress supplying data to iOS apps
Integration done through JSON API
Now we got the REST API
What is it?• API is short for Application Program Interface
• Its for interaction with the wider world
• A REST API, in turn, is a particular architectural approach
• REST stands for Representational State Transfer
• Use HTTP methods explicitly: It takes place over the web with standard HTTP methods such as PUT, GET, POST and DELETE.
What’s currently in core• Currently the infrastructure has been added in 4.4
• The infrastructure handles the routing, argument handling, JSON serialisation/deserialisation, status codes, and all that other lovely REST stuff.
• No endpoints has been added yet
How to interact with it• rest_api_init to register your routes
How to interact with it
Apple TV
What is it?• A digital media player and micro console
• Can receive digital data from a number of sources
• Most used to stream videos from the iTunes
• Another great feature is the ability to use AirPlay
The latest version• Complete new OS called tvOS
• Latest generation finally got an app store
• Including a refreshed remote with Siri support
• All apps due need to have Siri support
How to build something for it• Going the native way in Swift
• Using the template engine, TVML
• It has great new APIs for developers to use and build great new applications
TVML
What is it?• Use Apple’s Television Markup Language (TVML)
to create individual pages inside of a client-server app
• Every page in a client-server app is built on a TVML template
• TVML templates define what elements can be used and in what order
• Each template is designed to display information in a specific way
productTemplate
Above the fold
Under the fold
WooCommerce integration
WordPress Plugin
Integration• Using the REST API to serve other data then JSON
• Using filter ‘rest_pre_serve_request’ to do so
• Serving Javascript for the application logic
• Serving XML template though a Javascript variable
• Soon API endpoint for HTML dialog for payments
Templates• Build the templates of Apple as classes
• Add helper methods to pass in the information
• Can be extended/changed by the filter wc_appletv_templates
The TV APP
The TV APP• Almost default demo app for now
• Add header to WordPress that gets the javascript application URL
• App checks if the REST API and Application URL are given
• First interaction of Swift with Javascript
Current issues
It’s not exactly HTML
Payment
DEMO
HOME SCREEN
CATALOG
CATALOG WITHOUT MENU
DISCOUNTS
PRODUCT (ABOVE FOLD)
PRODUCT (BELOW FOLD)
will this be the future
Marko HeijnenFounder of CodeKitchen
Ex-lead developer of GlotPress
Core contributor for WordPress
Organizer for WordCamp Belgrade
Thank you for listening
Questions?