Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Example-driven Web API Specification Discovery

7 494 vues

Publié le

Slides of my presentation at European Conference on Modelling Foundations and Applications (ECMFA'17). To be presented during the session on Thursday 16:00-17:30

Publié dans : Sciences
  • Login to see the comments

  • Soyez le premier à aimer ceci

Example-driven Web API Specification Discovery

  1. 1. Flickr/BenNuttall flickr/FraserMummery Example-driven Web API Specification Discovery Hamza Ed-douibi, Javier L. Cánovas Izquierdo, Jordi Cabot
  2. 2. Motivation flickr/airpix
  3. 3. API Economy
  4. 4. API Economy
  5. 5. API Economy
  6. 6. API Economy
  7. 7. API Economy
  8. 8. API Economy
  9. 9. …consortium of forward-looking industry experts who recognize the immense value of standardizing on how REST APIs are described… …is focused on creating, evolving and promoting a vendor neutral description format… https://www.openapis.org
  10. 10. OpenAPI Example http://petstore.swagger.io/v2/pet/123GET "swagger":"2.0", "host":"petstore.swagger.io", "basePath":"/v2", Metadata { "swagger": "2.0", "info": { "version": "1.0.0", "title": "Swagger Petstore", "license": { "name": "MIT" } }, "host": "petstore.swagger.io", "basePath": "/v1", "schemes": [ "http" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/pets": { "get": { "summary": "List all pets", "operationId": "listPets", "tags": [ "pets" ], "parameters": [ { "name": "limit", "in": "query", "description": "How many items to return at one time (max 100)", "required": false, "type": "integer", "format": "int32" } ], "responses": { "200": { "description": "An paged array of pets", "headers": { "x-next": { "type": "string", "description": "A link to the next page of responses" } }, "schema": { "$ref": "#/definitions/Pets" } }, "default": { "description": "unexpected error", "schema": { "$ref": "#/definitions/Error" } } } }, OpenAPI document
  11. 11. OpenAPI Example http://petstore.swagger.io/v2/pet/123GET "swagger":"2.0", "host":"petstore.swagger.io", "basePath":"/v2", Metadata "paths":{ "/pet/{petId}":{ "get":{ "parameters":[ { "name":"petId", "in":"path",... } ], "responses":{ "200":..., },... },... }, Operations { "swagger": "2.0", "info": { "version": "1.0.0", "title": "Swagger Petstore", "license": { "name": "MIT" } }, "host": "petstore.swagger.io", "basePath": "/v1", "schemes": [ "http" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/pets": { "get": { "summary": "List all pets", "operationId": "listPets", "tags": [ "pets" ], "parameters": [ { "name": "limit", "in": "query", "description": "How many items to return at one time (max 100)", "required": false, "type": "integer", "format": "int32" } ], "responses": { "200": { "description": "An paged array of pets", "headers": { "x-next": { "type": "string", "description": "A link to the next page of responses" } }, "schema": { "$ref": "#/definitions/Pets" } }, "default": { "description": "unexpected error", "schema": { "$ref": "#/definitions/Error" } } } }, OpenAPI document
  12. 12. OpenAPI Example http://petstore.swagger.io/v2/pet/123GET "swagger":"2.0", "host":"petstore.swagger.io", "basePath":"/v2", Metadata "paths":{ "/pet/{petId}":{ "get":{ "parameters":[ { "name":"petId", "in":"path",... } ], "responses":{ "200":..., },... },... }, Operations { "swagger": "2.0", "info": { "version": "1.0.0", "title": "Swagger Petstore", "license": { "name": "MIT" } }, "host": "petstore.swagger.io", "basePath": "/v1", "schemes": [ "http" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/pets": { "get": { "summary": "List all pets", "operationId": "listPets", "tags": [ "pets" ], "parameters": [ { "name": "limit", "in": "query", "description": "How many items to return at one time (max 100)", "required": false, "type": "integer", "format": "int32" } ], "responses": { "200": { "description": "An paged array of pets", "headers": { "x-next": { "type": "string", "description": "A link to the next page of responses" } }, "schema": { "$ref": "#/definitions/Pets" } }, "default": { "description": "unexpected error", "schema": { "$ref": "#/definitions/Error" } } } }, OpenAPI document "definitions":{ "Pet":{ "type":"object", "properties":{ "id":..., "category":..., "name“:..., ... } } Schema
  13. 13. OpenAPI Example http://petstore.swagger.io/v2/pet/123GET "swagger":"2.0", "host":"petstore.swagger.io", "basePath":"/v2", Metadata "paths":{ "/pet/{petId}":{ "get":{ "parameters":[ { "name":"petId", "in":"path",... } ], "responses":{ "200":..., },... },... }, Operations { "swagger": "2.0", "info": { "version": "1.0.0", "title": "Swagger Petstore", "license": { "name": "MIT" } }, "host": "petstore.swagger.io", "basePath": "/v1", "schemes": [ "http" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/pets": { "get": { "summary": "List all pets", "operationId": "listPets", "tags": [ "pets" ], "parameters": [ { "name": "limit", "in": "query", "description": "How many items to return at one time (max 100)", "required": false, "type": "integer", "format": "int32" } ], "responses": { "200": { "description": "An paged array of pets", "headers": { "x-next": { "type": "string", "description": "A link to the next page of responses" } }, "schema": { "$ref": "#/definitions/Pets" } }, "default": { "description": "unexpected error", "schema": { "$ref": "#/definitions/Error" } } } }, OpenAPI document "definitions":{ "Pet":{ "type":"object", "properties":{ "id":..., "category":..., "name“:..., ... } } Schema
  14. 14. Advantages Publication & promotion
  15. 15. Advantages Publication & promotion Querying
  16. 16. Our approach flickr/Pascal
  17. 17. Approach
  18. 18. Approach
  19. 19. Approach
  20. 20. Approach
  21. 21. Approach
  22. 22. General view of the approach
  23. 23. Example provision { "request": { "method" : "POST" , "url" : "http://petstore... ", "body" : { ... } }, "response" : { "status" : 200, "body" : { ... } } } { "request": { "method" : "GET" , "url" : "http://petstore... ", "body" : { ... } }, "response" : { "status" : 200, "body" : { ... } } } { "request": { "method" : "GET" , "url" : "http://petstore... ", "body" : { ... } }, "response" : { "status" : 200, "body" : { ... } } }
  24. 24. APIDiscoverer
  25. 25. APIDiscoverer
  26. 26. The OpenAPI Metamodel
  27. 27. APIDiscoverer
  28. 28. Discovery & Enrichment Source Target host basepath protocol API relativePath Path httpMethod request-body response-body Operation query relative-Path request-Body Parameter response-Code Response request-body response-body Schema Behavioral Discoverer http://petstore.swagger.io/v2/pet/123GET
  29. 29. Discovery & Enrichment Source Target host basepath protocol API relativePath Path httpMethod request-body response-body Operation query relative-Path request-Body Parameter response-Code Response request-body response-body Schema Behavioral Discoverer http://petstore.swagger.io/v2/pet/123GET { "id": 123, "category": { "id": 1, "name": "dogs" }, "name": "doggie", "photoUrls": [ "http://exampleTcom" ], "tags": [ { "id": 1, "name": "black" } ], "status": "available" } Response
  30. 30. Discovery & Enrichment Source Target host basepath protocol API relativePath Path httpMethod request-body response-body Operation query relative-Path request-Body Parameter response-Code Response request-body response-body Schema Behavioral Discoverer http://petstore.swagger.io/v2/pet/123GET
  31. 31. Structural Discoverer JSONDiscoverer Source Target host basepath protocol API relativePath Path httpMethod request-body response-body Operation query relative-Path request-Body Parameter response-Code Response request-body response-body Schema Behavioral Discoverer { "id": 123, "category": { "id": 1, "name": "dogs" }, "name": "doggie", "photoUrls": [ "http://exampleTcom" ], "tags": [ { "id": 1, "name": "black" } ], "status": "available" } Response Discovery & Enrichment
  32. 32. Discovery & Enrichment http://petstore.swagger.io/v2/pet/123GET
  33. 33. APIDiscoverer Example 1
  34. 34. APIDiscoverer Example 1 Example 2 Example 3 Example n
  35. 35. Generator { "swagger":"2.0", "info":{ }, "host":"petstore.swagger.io","basePath":"/v2", "tags":[ "pet" ],"Schemes":[ "http" ], "paths":{ "/pet/{petId}":{ "get":{ "produces":["application/json"], "parameters":[{"name":"petId","in":"path","type":"integer"}], "responses":{ "200":{ "description":"OK", "schema":{"$ref":"#/definitions/Pet" }}}} }}, "definitions":{ "Pet":{ "type":"object", "properties":{ "id":{"type":"integer"}, "category":{"$ref":"#/definitions/Category"}, "name":{"type":"string"}, "photoUrls":{"type":"array","items":{"type":"string"}}, "tags":{"type":"array","items":{"$ref":"#/definitions/Tag"}}, "Status":{"type":"string"}}, }}}
  36. 36. flickr/CodeRo
  37. 37. Tool Support APIDiscoverer https://github.com/SOM-Research/APIDiscoverer
  38. 38. HAPI HAPI (Home of APIs) https://github.com/SOM-Research/hapi APIDiscoverer Query
  39. 39. flickr/derekBruff
  40. 40. Conclusion and Further Work • Application of model-driven techniques for API discovery • Provided as Open Source tool • Help developers to integrate APIs What we have shown What we plan to do Extension of HAPI Automatic call generation OpenAPI Extensions • Quality of Service • Business Plans • Security • Semantics
  41. 41. Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution 4.0 International license. Thanks! HAPI (Home of APIs) https://github.com/SOM-Research/hapi APIDiscoverer https://github.com/SOM-Research/APIDiscoverer Javier L. Cánovas Izquierdo jcanovasi@uoc.edu @jlcanovas Hamza Ed-douibi hed-douibi@uoc.edu @mazamiz Jordi Cabot jordi.cabot@icrea.cat @softmodeling

×