1
Design-First API Development Using Swagger & Node
Scott Ganyo, Apigee Prabhat Jha, Apigee
@theganyo @prabhatjha
Agenda
2
1. APIs - What and Why
2.
What is Design-First API
development?
3. Some Apigee internal use cases
4. Customer Reference
5. Tools & demo
6. Q&A
©2015 Apigee. All Rights Reserved.
APIS
3
An API…
Defines an HTTP service
Serves its client apps
Drives service adoption
APIs
4©2015 Apigee. All Rights Reserved.
APIs are for…
Developers
Apps :
• External
• Internal
Microservices
Devices
5©2015 Apigee. All Rights Reserved.
What APIs are not ?
SOA++
ESB
6©2015 Apigee. All Rights Reserved.
Design-First API
Development
7
The Zen of API Development
The code defines the API
The API generates the code
The code is the API
API-driven code
8©2015 Apigee. All Rights Reserved.
The code defines the API
9©2015 Apigee. All Rights Reserved.
Annotation-driven
Maintained in code
API is generated
The API generates the code
Interface Definition Language (IDL) defines the API
Client and serverside code stubs are generated
Examples: SOAP, CORBA, and similar RPC systems
10©2015 Apigee. All Rights Reserved.
The code is the API
11©2015 Apigee. All Rights Reserved.
Interpreted
No formal specification
API-driven philosophy
12©2015 Apigee. All Rights Reserved.
The API must be designed first.
API-driven philosophy
13©2015 Apigee. All Rights Reserved.
API design, documentation, and code must remain in sync.
API-driven philosophy
14©2015 Apigee. All Rights Reserved.
The system must adhere to the "DRY Principle."
API-driven philosophy
15©2015 Apigee. All Rights Reserved.
The API must directly drive runtime and documentation.
Swagger-Node
16
Swagger-Node: Flow Diagram
17©2015 Apigee. All Rights Reserved.
Swagger-Node
18©2015 Apigee. All Rights Reserved.
The API is written in Swagger, optionally using API Studio (apistudio.io)
The Swagger API document is parsed when server starts
Incoming calls are classified, validated, and routed in real time
Integrates with Connect, Express, Hapi, Restify, Sails...
Incorporates a plugin model for Swagger (or non-Swagger) extensions
Apigee Use Cases
19
Use case: Recommendation API (Apigee Insights)
• To personalize an app experience, developers need to quickly create
APIs that mashup results from big fata machine learning and real-time
events. Swagger-node enables quick creation of those APIs via
Swagger, and create the business-logic necessary in node.js.
20©2015 Apigee. All Rights Reserved.
Use case: API Studio
• Authoring
• Collaboration
• Response simulation
21©2015 Apigee. All Rights Reserved.
Use case: Test Coverage
• Historical test coverage analysis
• APIs for CI to update
• UI for test teams
22©2015 Apigee. All Rights Reserved.
Customer Reference
23
Burberry
24©2015 Apigee. All Rights Reserved.
Tools & Demo
25
API Lifecycle management tools
• Write & Collaborate:
– API Studio (http://apistudio.io)
• Develop :
– Swagger-Node (npm install -g swagger)
• Deploy
• Apigee Edge
• Your PaaS
• Publish
• Apigee Dev Portal
• API Studio
26©2015 Apigee. All Rights Reserved.
Demo
27©2015 Apigee. All Rights Reserved.
Where to get help?
https://community.apigee.com
28©2015 Apigee. All Rights Reserved.
Q&A
29
Thank You
30

Design-first API Development using Swagger and Node

  • 1.
    1 Design-First API DevelopmentUsing Swagger & Node Scott Ganyo, Apigee Prabhat Jha, Apigee @theganyo @prabhatjha
  • 2.
    Agenda 2 1. APIs -What and Why 2. What is Design-First API development? 3. Some Apigee internal use cases 4. Customer Reference 5. Tools & demo 6. Q&A ©2015 Apigee. All Rights Reserved.
  • 3.
  • 4.
    An API… Defines anHTTP service Serves its client apps Drives service adoption APIs 4©2015 Apigee. All Rights Reserved.
  • 5.
    APIs are for… Developers Apps: • External • Internal Microservices Devices 5©2015 Apigee. All Rights Reserved.
  • 6.
    What APIs arenot ? SOA++ ESB 6©2015 Apigee. All Rights Reserved.
  • 7.
  • 8.
    The Zen ofAPI Development The code defines the API The API generates the code The code is the API API-driven code 8©2015 Apigee. All Rights Reserved.
  • 9.
    The code definesthe API 9©2015 Apigee. All Rights Reserved. Annotation-driven Maintained in code API is generated
  • 10.
    The API generatesthe code Interface Definition Language (IDL) defines the API Client and serverside code stubs are generated Examples: SOAP, CORBA, and similar RPC systems 10©2015 Apigee. All Rights Reserved.
  • 11.
    The code isthe API 11©2015 Apigee. All Rights Reserved. Interpreted No formal specification
  • 12.
    API-driven philosophy 12©2015 Apigee.All Rights Reserved. The API must be designed first.
  • 13.
    API-driven philosophy 13©2015 Apigee.All Rights Reserved. API design, documentation, and code must remain in sync.
  • 14.
    API-driven philosophy 14©2015 Apigee.All Rights Reserved. The system must adhere to the "DRY Principle."
  • 15.
    API-driven philosophy 15©2015 Apigee.All Rights Reserved. The API must directly drive runtime and documentation.
  • 16.
  • 17.
    Swagger-Node: Flow Diagram 17©2015Apigee. All Rights Reserved.
  • 18.
    Swagger-Node 18©2015 Apigee. AllRights Reserved. The API is written in Swagger, optionally using API Studio (apistudio.io) The Swagger API document is parsed when server starts Incoming calls are classified, validated, and routed in real time Integrates with Connect, Express, Hapi, Restify, Sails... Incorporates a plugin model for Swagger (or non-Swagger) extensions
  • 19.
  • 20.
    Use case: RecommendationAPI (Apigee Insights) • To personalize an app experience, developers need to quickly create APIs that mashup results from big fata machine learning and real-time events. Swagger-node enables quick creation of those APIs via Swagger, and create the business-logic necessary in node.js. 20©2015 Apigee. All Rights Reserved.
  • 21.
    Use case: APIStudio • Authoring • Collaboration • Response simulation 21©2015 Apigee. All Rights Reserved.
  • 22.
    Use case: TestCoverage • Historical test coverage analysis • APIs for CI to update • UI for test teams 22©2015 Apigee. All Rights Reserved.
  • 23.
  • 24.
  • 25.
  • 26.
    API Lifecycle managementtools • Write & Collaborate: – API Studio (http://apistudio.io) • Develop : – Swagger-Node (npm install -g swagger) • Deploy • Apigee Edge • Your PaaS • Publish • Apigee Dev Portal • API Studio 26©2015 Apigee. All Rights Reserved.
  • 27.
    Demo 27©2015 Apigee. AllRights Reserved.
  • 28.
    Where to gethelp? https://community.apigee.com 28©2015 Apigee. All Rights Reserved.
  • 29.
  • 30.