phpughh: apigility

42
APIGILITY APIGILITY Heute klicken wir unsere API einfach mal zusammen... Heute klicken wir unsere API einfach mal zusammen... 1 / 42 Heute Heute Mit Quiz! Mit Quiz!

Upload: ralf-eggert

Post on 27-Jun-2015

343 views

Category:

Technology


1 download

DESCRIPTION

Heute klicken wir unsere API einfach mal zusammen...

TRANSCRIPT

Page 1: PHPughh: Apigility

APIGILITYAPIGILITYHeute klicken wir unsere API einfach mal zusammen...Heute klicken wir unsere API einfach mal zusammen...

1 / 42

HeuteHeuteMit Quiz!Mit Quiz!

Page 2: PHPughh: Apigility

Über Ralf EggertÜber Ralf Eggert

2 / 42

Page 3: PHPughh: Apigility

[B00]

PrologProlog

3 / 42

Page 4: PHPughh: Apigility

[B01]

4 / 42

Neue APINeue APIin zwei in zwei Stunden?Stunden?

Page 5: PHPughh: Apigility

[B02]

5 / 42

Nimm dochNimm dochApigility!Apigility!

Page 6: PHPughh: Apigility

[B03]

In a NutshellIn a Nutshell

6 / 42

Page 7: PHPughh: Apigility

Restful Web ServicesRestful Web Services

7 / 42

CLIENT

Web Browser

PHP

Javascript

RUBY

PYTHON

REST SERVER

/api/user/123

/api/user

/api/user

/api/user/123

/api/user/123

USER DOMAIN

getUserEntity()

getUserCollection()

addUserEntity()

updateUserEntity()

deleteUserEntity()

GET Request

JSON Response

GET Request

JSON Response

POST Request

JSON Response

PUT Request

JSON Response

DELETE Request

JSON Response

Integer

UserEntity

void

UserCollection

Array

Boolean

Integer, Array

Boolean

Integer

Boolean

Page 8: PHPughh: Apigility

RPC Web ServicesRPC Web Services

8 / 42

LocalCLIENT

javascript

RPCClient

JSON

Method:getUserParams:id

USER DOMAIN

getUserEntity()

GET Request

JSON Result

Integer

UserEntity

RPCServer

/json-rpc.php

Remote Call

JSON Result

javascriptJSON

Method:addUserParams:name

addUserEntity()

POST Request

JSON Result

Array

Boolean

/json-rpc.php

Remote Call

JSON Result

javascriptXML

Method:getUserParams:id

getUserEntity()

GET Request

XML Result

Integer

UserEntity

/xml-rpc.php

Remote Call

XML Result

javascriptXML

Method:addUserParams:name

addUserEntity()

POST Request

XML Result

Array

Boolean

/xml-rpc.php

Remote Call

XML Result

Page 9: PHPughh: Apigility

VersionierungVersionierung

default Version per URLdefault Version per URL

Version 1 per URLVersion 1 per URL

Version 2 per URLVersion 2 per URL

default Version per Content Negotiationdefault Version per Content Negotiation

Version 1 per Content NegotiationVersion 1 per Content Negotiation

Version 2 per Content NegotiationVersion 2 per Content Negotiation

9 / 42

Page 10: PHPughh: Apigility

JSON / HAL / ProblemJSON / HAL / Problem

10 / 42

Page 11: PHPughh: Apigility

WEITERE FEATURESWEITERE FEATURES

Datenbank-basiertDatenbank-basiert Code-basiertCode-basiert authentifizierungauthentifizierung

API DokumentationAPI Dokumentation DatenvalidierungDatenvalidierung DeploymentDeployment

11 / 42

[B04] [B05][B05] [B06]

[B07] [B08][B08] [B09][B09]

Page 12: PHPughh: Apigility

ModularisierungModularisierungZf-apigilityZf-apigility Zf-apigility-adminZf-apigility-admin Zf-apigility-documentationZf-apigility-documentation

Zf-apigility-documentation-swaggerZf-apigility-documentation-swagger Zf-apigility-providerZf-apigility-provider Zf-apigility-WelcomeZf-apigility-Welcome

Zf-api-problemZf-api-problem Zf-configurationZf-configuration Zf-content-negotiationZf-content-negotiation

Zf-content-validationZf-content-validation Zf-deployZf-deploy Zf-development-modeZf-development-mode

Zf-halZf-hal Zf-mvc-authZf-mvc-auth Zf-oauth2Zf-oauth2

Zf-restZf-rest Zf-RPCZf-RPC Zf-versioningZf-versioning

12 / 42

Page 13: PHPughh: Apigility

InstallationInstallationCurl und Composer$ curl -s https://getcomposer.org/installer | php --$ php composer.phar create-project -sdev zfcampus/zf-apigility-skeleton /path/to/install$ cd /path/to/install

ZIP und Composer$ wget https://github.com/zfcampus/zf-apigility-skeleton/archive/master.zip$ unzip -d /path/to/install master.zip $ cd /path/to/install$ php composer.phar install

Git und Composer$ git clone https://github.com/zfcampus/zf-apigility-skeleton.git /path/to/install$ cd /path/to/install$ php composer.phar install

Entwicklungsmodus einschalten und Rechte setzen$ php public/index.php development enable$ sudo chmod 777 -R config/$ sudo chmod 777 -R data/$ sudo chmod 777 -R module/

13 / 42

Page 14: PHPughh: Apigility

StartseiteStartseite

14 / 42

Page 15: PHPughh: Apigility

[B04]

DB-basierterDB-basierterREST-ServiceREST-Service

15 / 42

Page 16: PHPughh: Apigility

DatenbankmodellDatenbankmodell

16 / 42

Page 17: PHPughh: Apigility

DatenbankadapterDatenbankadapter

Schritte 1 bis 6Schritte 1 bis 617 / 42

Page 18: PHPughh: Apigility

Rest Service, DB-basiertRest Service, DB-basiert

Schritte 1 bis 6Schritte 1 bis 618 / 42

Page 19: PHPughh: Apigility

Rest Service, DB-basiertRest Service, DB-basiert

19 / 42Schritte 7 bis 12Schritte 7 bis 12

Page 20: PHPughh: Apigility

Rest Service, DB-basiertRest Service, DB-basiert

20 / 42Schritte 13 bis 18Schritte 13 bis 18

Page 21: PHPughh: Apigility

REST Service User ListeREST Service User Liste

21 / 42

Page 22: PHPughh: Apigility

REST Service User EntityREST Service User Entity

22 / 42

Page 23: PHPughh: Apigility

[B10]

POSTPOSTPUTPUT

DELETEDELETE23 / 42

Page 24: PHPughh: Apigility

Rest Service Post IRest Service Post I

24 / 42Schritte 1 bis 3Schritte 1 bis 3

Page 25: PHPughh: Apigility

Rest Service Post IIRest Service Post II

25 / 42Schritte 4 bis 6Schritte 4 bis 6

Page 26: PHPughh: Apigility

Rest Service Put IRest Service Put I

26 / 42Schritte 1 bis 3Schritte 1 bis 3

Page 27: PHPughh: Apigility

Rest Service Put IIRest Service Put II

27 / 42Schritt 4Schritt 4

Page 28: PHPughh: Apigility

Rest Service DeleteRest Service Delete

28 / 42Schritte 1 bis 3Schritte 1 bis 3

Page 29: PHPughh: Apigility

[B06]

AUTHENTIFI-AUTHENTIFI-ZIERUNGZIERUNG

29 / 42

Page 30: PHPughh: Apigility

Authentifizierung IAuthentifizierung I

HTpasswd$ htpasswd -c data/htpasswd apigilityNew password: *********Re-type new password: *********Adding password for user apigility$

OAUTH2HTTP DIGESTHTTP BASIC

30 / 42

Page 31: PHPughh: Apigility

Authentifizierung IIAuthentifizierung II

31 / 42Schritte 1 bis 6Schritte 1 bis 6

Page 32: PHPughh: Apigility

Authentifizierung IIIAuthentifizierung III

32 / 42Schritt 7Schritt 7

Page 33: PHPughh: Apigility

Authentifizierung IVAuthentifizierung IV

33 / 42Schritt 8Schritt 8

Page 34: PHPughh: Apigility

[B05]

Code-basierterCode-basierterREST SERVICE?REST SERVICE?

34 / 42

Page 35: PHPughh: Apigility

[B11]

35 / 42

Beim Beim NächstenNächstenMal...Mal...

Page 36: PHPughh: Apigility

[B00]

EPILOGEPILOG

36 / 42

Page 37: PHPughh: Apigility

[B12]

37 / 42

Und wann Und wann kommtkommtDas Quiz?Das Quiz?

Page 38: PHPughh: Apigility

[B02]

38 / 42

Frage 1:Frage 1:Aus wie vielen Aus wie vielen einzelnen Modulen einzelnen Modulen wurde Apigility wurde Apigility aufgebaut?aufgebaut?

Page 39: PHPughh: Apigility

[B02]

39 / 42

Frage 2:Frage 2:Welche Arten Welche Arten von Webservices von Webservices werden werden unterstützt?unterstützt?

Page 40: PHPughh: Apigility

[B02]

40 / 42

Frage 3:Frage 3:Welche HTTP Welche HTTP Methoden haben Methoden haben wir implementiert?wir implementiert?

Page 41: PHPughh: Apigility

APIGILITYAPIGILITYKlappt für einfache APIs, ansonsten ist Handarbeit erforderlich...Klappt für einfache APIs, ansonsten ist Handarbeit erforderlich...

Repository: https://github.com/RalfEggert/phpughh-apigility

41 / 42

Page 42: PHPughh: Apigility

BildnachweisBildnachweis[B00] Fotos von Ralf Eggert

[B01] Still here https://www.flickr.com/photos/thenovys/3784261365 von Abe Novy - CC-BY https://creativecommons.org/licenses/by/2.0/

[B02] Young student https://www.flickr.com/photos/audiolucistore/14159712431/ von www.audio-luci-store.it - CC-BY https://creativecommons.org/licenses/by/2.0/

[B03] Acorns https://www.flickr.com/photos/dno1967b/5431273344 von Daniel Oines - CC-BY https://creativecommons.org/licenses/by/2.0/

[B04] Fixing the database https://www.flickr.com/photos/dahlstroms/4140461901 von Håkan Dahlström - CC-BY https://creativecommons.org/licenses/by/2.0/

[B05] Monaco 14pt https://www.flickr.com/photos/polarity/3138680190 von Robert Agthe - CC-BY https://creativecommons.org/licenses/by/2.0/

[B06] RSA Securid Token - Credit Card Style https://www.flickr.com/photos/purpleslog/265657780 von Purple Slog - CC-BY https://creativecommons.org/licenses/by/2.0/

[B07] Shelf of Used Books https://www.flickr.com/photos/thedarkthing/5363586197 von William Ross - CC-BY https://creativecommons.org/licenses/by/2.0/

[B08] Ticket validator at Nice train station https://www.flickr.com/photos/traveleden/3797157077 von Simon - CC-BY https://creativecommons.org/licenses/by/2.0/

[B09] Test Lab - Supermicro Storage https://www.flickr.com/photos/jemimus/8533890844 von Robert - CC-BY https://creativecommons.org/licenses/by/2.0/

[B10] We are all fan of laptops https://www.flickr.com/photos/scottvanderchijs/4493248747 von Scott & Elaine van der Chijs - CC-BY https://creativecommons.org/licenses/by/2.0/

[B11] Laugh https://www.flickr.com/photos/wounded/4105835342 von Simon Claassen - CC-BY https://creativecommons.org/licenses/by/2.0/

[B12] Surprise https://www.flickr.com/photos/photographybycolby/11927931295 von Colby Stopa - CC-BY https://creativecommons.org/licenses/by/2.0/

Alle weiteren Screenshots wurden von Ralf Eggert erstellt.

42 / 42