Top Banner
API PLATFORM Semantic web for the masses
58

API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Sep 10, 2018

Download

Documents

buikiet
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

API PLATFORMSemantic web for the masses

Page 2: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Kévin DunglasFounder of Les-Tilleuls.coop

Symfony Core Team

API Platform creator

@dunglas

Page 3: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Les-Tilleuls.coop

👊 Self-managed since 2011⬆ 97% in 2016, 25 nice people👷 ➡ [email protected]

Dev, consulting and training

Page 4: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

APIs: the Heart of the New Web

Page 5: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Progressive Web Apps

Downloaded only 1 time, works offline!

Sends async HTTP requests to the API

Huge ecosystem: React, Angular, Vue…

Holds the presentation logic

Static « website »: JS, HTML and CSS

Page 6: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Native Mobile Apps

Sync data by sending HTTP requests to the API

JS stack:React Native, NativeScript

Downloaded from stores (App Store, Google Play)

Look’n’Feel consistent with the platform (iOS or Android)

Page 7: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

The SemWeb in 2017

Page 8: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Data Interop at Web-scaleCommon format

Common vocabularies / ontologies / taxonomies

Machine-readable

Queryable

Ability to aggregate data from different sources

Top priority topic for APIs

Page 9: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Real-life benefitsComplex queries, data aggregation:

Find all congressmen

-> elected in France -> not involved in a corruption case using the french gov’s Open Data API and Wikipedia as data source

Generic apps and libraries

Accounting software compatible with all e-commerce platforms

Admin interface able to deal with any data sources

Page 10: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests
Page 11: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Most APIs have no SemWeb support at all.

Page 12: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

The avg Dev about SemWebExotic academic techs, elitist community

Hard to learn and understand (specs proliferation)

No dev-friendly tooling for popular languages (JS, PHP, Go…)

Prefer using industry-leading alternatives (Facebook’s GraphQL…)

Too much XML (hard to learn, slow on mobile devices)

Page 13: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

No massive adoption means very

limited benefits.

Page 14: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

No Fatality

Page 15: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

JSON-LDStandardized hypermedia format: W3C recommandation (2014)

Easy to use: a standard JSON document with some specials keys (starting with @) and mapped with a context

Backed by Google, BBC, Microsoft, US & UK govs...

Compliant with technologies of the semantic web: RDF, SPARQL, triple store...

JSON for Linked Data

100% compatible with the way the AVG dev create APIs and apps

Page 16: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests
Page 17: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests
Page 18: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests
Page 19: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests
Page 20: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests
Page 21: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests
Page 22: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Hydra

Page 23: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Hydra

auto-discoverable API:resources, properties, types, operations

Standardize common API structures:collections, paginations, filters, errors…

In-band API doc

Draft W3C

Page 24: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests
Page 25: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests
Page 26: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Schema.org

Page 27: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Schema.org

Understood by Google, Bing, Yahoo! and Yandex

Massively used, W3C-backed (Web Schemas Group)

Large set of elements: people, events, products, chemicals…

Open vocabulary

Official support for RDFa, microdata and JSON-LD

Can be extended (custom vocabularies)

Page 28: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

API Platform:Linked Data Framework

for the Masses

Page 29: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Goals

High grade Linked Data support

Rock-solid API in minutes

Create, consume, test and deploy

Customizable, extensible, modular

Built with popular battle-tested techs:PHP (Symfony) and JavaScript (React)

Page 30: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Getting Started

Page 31: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Install

Grab a release on GitHub

Browse https://localhost

$ docker-compose up

Page 32: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests
Page 33: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Your Turn!

Page 34: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Browse Schema.org

Page 35: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Pick the types you want…

$ bin/schema generate-types src

Page 36: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

… to Generate a Class

Page 37: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Guessed from OWL

ORM mapping (Doctrine)

PHP classes, properties, getters and setters

JSON-LD context mapping

Validation constraints (Symfony

PHPDoc from vocab’s human-readable descriptions

Work with any vocal defined in OWL or RDFa!

Page 38: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Or Create yourown Class

PHPDoc extraction (optional)

The hook:@ApiResourceXML and YAML also supported

Doctrine integration (optional)

Plain Old PHP Object

$ docker-compose exec php bin/console \ doctrine:schema:update --force

Page 39: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests
Page 40: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Your 1st API is ready!

Page 41: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Other Features

Page 42: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Client-sidetools

Page 43: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Admin

Page 44: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

API Platform AdminAutomatic admin interface

Built on top of Admin On Rest (by Marmelab)

Material Design

Automatically generates the admin by parsing the Hydra API doc

Browse https://localhost:8001

Page 45: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests
Page 46: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Clients Generator

Page 47: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

React PWA Generator (default)

scaffolding tool, 100% client-side

Rock solid stack

Twitter Bootstrap support + accessibility (ARIA roles)

Use ES2015’s fetch()

Parse Hydra API doc to generate files

Page 48: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests
Page 49: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests
Page 50: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Other SkeletonsReact Native

TypeScript definitions

Your preferred technology: Pull Requests very appreciated!

Angular

Vue.js

Page 51: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

React Native

$ generate-api-platform-client \ http://localhost src/ \ —g react-native

Page 52: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Deploy in Clouds

Page 53: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Kubernetes & HelmK8S: « Production-Grade Container Orchestration », by Google

Powers Google Kubernetes Engine and Azure Container ServiceHelm: official K8S package manager (like APT or Homebrew), by MicrosoftFree software

Page 54: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Deploy in the CloudA Helm chart is provided with API Platform

# …Build and push the Docker images… # …Connect to your Kubernetes cluster…

$ helm install ./api/helm/api --name api

The project is deployed, managed, and scale!

Page 55: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

A Growing CommunityBest 2017 Symfony Bundle

2k stars on GitHub1k followers on Twitter200+ contributors

Page 56: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

They already Use API Platform

Page 57: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests
Page 58: API PLATFORM - SemWeb.Prosemweb.pro/file/.../raw/16_API-Platform-LeWebSemantiquePourLesMa… · Progressive Web Apps Downloaded only 1 time, works offline! Sends async HTTP requests

Thanks!Any questions?

api-platform/api-platform @ApiPlatform

https://api-platform.com