design first api's with raml and soapui

62
API First Development with RAML and SoapUI Daniel Feist @dfeist Principal Architect, MuleSoft Matti Hjelm Product Manager, SmartBear

Upload: daniel-feist

Post on 11-May-2015

3.612 views

Category:

Technology


5 download

DESCRIPTION

Daniel Feist, Architect @ Mulesoft Matti Hjelm, SoapUI Product Manager @ SmartBear In this workshop we'll develop a real-world API together using RAML to define the interface and SoapUI to simulate and test the interface and API consumer experience before even thinking about the implementation. In doing this we'll cover the powerful design-first features of RAML as well as the tooling available to facilite this approach. We’ll also cover the mocking and prototyping features of SoapUI. Finally we'll implement, deploy and test our new API in a production environment.

TRANSCRIPT

Page 1: Design First API's with RAML and SoapUI

API First Development with

RAML and SoapUI

Daniel Feist @dfeist Principal Architect, MuleSoft

Matti Hjelm Product Manager, SmartBear

Page 2: Design First API's with RAML and SoapUI

Me?

Page 3: Design First API's with RAML and SoapUI

API Testing and Mocking

Page 4: Design First API's with RAML and SoapUI

Use Case

Page 5: Design First API's with RAML and SoapUI

•  (Fictitious) Global Shipping & Logistics Company •  Shipping via Truck/Ship/Air from Warehouses •  Two tiers of customers:

•  Pay as you go (small medium business) •  Premium Customers (e.g. Amazon, Macy’s, etc.)

•  Mythical looking for new ways to increase revenue •  Currently use FTP integration for partner enablement

Mythical Logistics Inc

Page 6: Design First API's with RAML and SoapUI

•  New revenue channel - Perishable Inventory •  Unused shipping capacity •  Last minute deals •  Low rates for premium subscription customers •  Operational efficiency

•  API Initiative •  Build new API for perishable inventory quote/shipment •  Leverage existing RateFinder Service for quote •  Enable mobile apps with new API

New Business Opportunity

6

Page 7: Design First API's with RAML and SoapUI

New ‘Business Shipping API’

/quote

RateFinder API

Perishable Inventory

Application /shipment

Business Shipping API Consumer apps API Implementation

Premium

Page 8: Design First API's with RAML and SoapUI

API Development

Lifecycle

Page 9: Design First API's with RAML and SoapUI

API Development Lifecycle

Test   Build   Publish   Operate  Design   Engage  Mock  

Page 10: Design First API's with RAML and SoapUI

Design

Page 11: Design First API's with RAML and SoapUI

•  The Client Application?

•  The Service Implementation?

So, what should we ‘Design’ first?

Page 12: Design First API's with RAML and SoapUI

ü  Interface is most important part of your API

ü where consumers touch you

ü your front door, your lobby, your façade

ü your brand

ü Good API helps achieve Adoption

ü  Enables parallel development.

ü  Allows you to start testing early.

Neither! The API interface..

Page 13: Design First API's with RAML and SoapUI

Model your API..

•  design for them your users •  iterate quickly •  model cleanly and consistently •  gather feedback •  test!

Valid

ate

Capture Feedback

API à APX

Page 14: Design First API's with RAML and SoapUI

Collaborate on API Design

Business Shipping API

Tom Shafii Product Manager, API’s

Mythical Logistics Inc.

Jason Hall Senior Developer

Mythical Logistics Inc.

Page 15: Design First API's with RAML and SoapUI

Design: The Contract

Page 16: Design First API's with RAML and SoapUI

WSDL?

* *

Page 17: Design First API's with RAML and SoapUI

What then?

* *

Format Strength Reusable Patterns

Sponsor

WADL (XML)

Swagger (JSON)

IODocs (JSON)

RestDoc (JSON)

API Blueprint

(Markdown)

RAML (YAML)

RestDoc

Page 18: Design First API's with RAML and SoapUI

WADL

Page 19: Design First API's with RAML and SoapUI

Swagger

Page 20: Design First API's with RAML and SoapUI

IOdocs

Page 21: Design First API's with RAML and SoapUI

API Blueprint

Page 22: Design First API's with RAML and SoapUI

Design:

Page 23: Design First API's with RAML and SoapUI

RAML

A new open spec for RESTful APIs that's as clean and as structured as REST itself

RESTful API Modeling Language

the RAML Workgroup: raml.org

Page 24: Design First API's with RAML and SoapUI

RAML: Clean & Structured.

Page 25: Design First API's with RAML and SoapUI

RAML: Reuse

resource type schema

trait

Page 26: Design First API's with RAML and SoapUI

Covers Full HTTP

optional version in baseUri

template URIs

query parameters

headers (on request and response)

response per status code

example (and schema) per media type

Page 27: Design First API's with RAML and SoapUI

Patterns: Resource Types

externalizable

inheritance

pull in traits

parametrize

Page 28: Design First API's with RAML and SoapUI

Patterns: Method-level traits

mix-ins

Page 29: Design First API's with RAML and SoapUI

Patterns: body schemas

or just use good ol' form data:

XML schema

JSON schema

examples

Page 30: Design First API's with RAML and SoapUI

Patterns: security schemes

username/password; cleartext or use digest

end user allows app to access their data

better to put token in header, not query

the OAuth multi-step dance

Page 31: Design First API's with RAML and SoapUI

Design Demo

Page 32: Design First API's with RAML and SoapUI

Demo

Page 33: Design First API's with RAML and SoapUI

Collaborate on API Design

Business Shipping API

Tom Shafii Product Manager, API’s

Mythical Logistics Inc.

Jason Hall Senior Developer

Mythical Logistics Inc.

Page 34: Design First API's with RAML and SoapUI

Mock

Page 35: Design First API's with RAML and SoapUI

Why Mock?

ü  To try it out!

ü Minimal investment

ü Find design issues early

ü  Provide early access to API for feedback.

ü  Start building clients

Page 36: Design First API's with RAML and SoapUI

Demo - Mock

Page 37: Design First API's with RAML and SoapUI

Prototype / Iterate

Business Shipping API

Tom Shafii Product Manager, API’s

Mythical Logistics Inc.

Jason Hall Senior Developer

Mythical Logistics Inc.

Ruby Mobile App Developer, Amazon Inc.

Feedback

New Reqs.

Mock

Page 38: Design First API's with RAML and SoapUI

Test

Page 39: Design First API's with RAML and SoapUI

Manual Testing

Page 40: Design First API's with RAML and SoapUI

Testing for Real..

ü  Scenario based testing

ü  Automated

ü  Reusable (design, dev, prod)

ü  Test Performance

Page 41: Design First API's with RAML and SoapUI

Demo - Test

Page 42: Design First API's with RAML and SoapUI

First, Test your Mock API

Business Shipping API

Jason Hall Senior Developer

Mythical Logistics Inc.

Mock

API Tests

Page 43: Design First API's with RAML and SoapUI

•  SoapUI testing the API •  Import RAML •  Mock the API •  Test the API (Mocked)

•  Improve the API •  Add cancel (verb DELETE)

•  Use the mock from client (Android)

Demo

Page 44: Design First API's with RAML and SoapUI

Testing actually improves Design

Mock Design Test

Page 45: Design First API's with RAML and SoapUI

Build

Page 46: Design First API's with RAML and SoapUI

Demo

Page 47: Design First API's with RAML and SoapUI

Test your API in Development

Business Shipping API

Jason Hall Senior Developer

Mythical Logistics Inc.

API Implementation

API Tests

Page 48: Design First API's with RAML and SoapUI

Publish

Page 49: Design First API's with RAML and SoapUI

Demo - Publish

Page 50: Design First API's with RAML and SoapUI

Test your API in Production

Business Shipping API API

Implementation

Ruby Rails Mobile App Developer, Amazon Inc.

Invoke API

Page 51: Design First API's with RAML and SoapUI

Operate

Page 52: Design First API's with RAML and SoapUI

•  Contract Enforcement •  Security •  Analytics •  Monetization

API Management

Page 53: Design First API's with RAML and SoapUI

Demo - Management

Page 54: Design First API's with RAML and SoapUI

Monitoring: Quality in production

•  Monitoring •  Synthetic vs RUM (real user monitoring) •  Use Alertsite •  Samma testsuite i design, utveckling, pre prod test

and post deploy •  Root cause APM tools

•  Debug API in production

Page 55: Design First API's with RAML and SoapUI

Demo - Monitoring

Page 56: Design First API's with RAML and SoapUI

API Operation

Business Shipping API API

Implementation

Invoke API

Page 57: Design First API's with RAML and SoapUI

Engage

Page 58: Design First API's with RAML and SoapUI

•  Having a delightful API!

•  Prototyping tools •  Interactive Console •  Notebook

•  Social Tools •  Rate, discuss •  Provide feedback •  Forum

Engage Developers

Page 59: Design First API's with RAML and SoapUI

Demo – API Portal

Page 60: Design First API's with RAML and SoapUI

Demo - API Notebook

Page 61: Design First API's with RAML and SoapUI

API Development Lifecycle

Test   Build   Publish   Operate  Design   Engage  Mock  

Page 62: Design First API's with RAML and SoapUI

Thank You!