apidays - api design workshop

34
Workshop Learn How To Design and Document an API with

Upload: restlet

Post on 16-Apr-2017

285 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: APIDays - API Design Workshop

Workshop

Learn How To Design and Document

an API

with

Page 2: APIDays - API Design Workshop

Workshop takeaways

How to get from the initial API project idea...

...to an API contract and its published documentation

Page 3: APIDays - API Design Workshop

Who are we?

Jonathan@j_michaux

product manager @ Restlet

Antoine@richard_antoine

product manager @ Restlet

Page 4: APIDays - API Design Workshop

RestletHelping agile teams deliver API projects

Page 5: APIDays - API Design Workshop

Workshop steps

1. Things to think about before you start

2. Create your API contract

3. Document and share your API

Page 6: APIDays - API Design Workshop

API DesignWhat to think about before you start crafting your API contract

Page 7: APIDays - API Design Workshop

● Is the API worth building? ● What problem does the API solve?

● How will the API be used?

● What API project methodology will we use?

API Design checklist

Page 8: APIDays - API Design Workshop

Is the API worth building?

Page 9: APIDays - API Design Workshop
Page 10: APIDays - API Design Workshop

What problem does the API solve?

People want to do car sharing

We offer a car sharing service

Developers want to integrate it into their apps

Page 11: APIDays - API Design Workshop

Ride Sharing API

Page 12: APIDays - API Design Workshop

How will the API be used?

APPUSER EXPERIENCE APIDEVELOPER

EXPERIENCE

Page 13: APIDays - API Design Workshop

Screenshot from BlaBlaCar

Page 14: APIDays - API Design Workshop

What API project methodology to use?

Page 15: APIDays - API Design Workshop
Page 16: APIDays - API Design Workshop
Page 17: APIDays - API Design Workshop

API Contract

Page 18: APIDays - API Design Workshop

Restlet Studio: API Design made easy

studio.restlet.com

Page 19: APIDays - API Design Workshop

Steps

1. resources

2. operations

3. responses

RFC 2616 (june 1999)

Page 20: APIDays - API Design Workshop

Identify resourcesWhat’s a resource?

“A network data object or service that

can be identified by a URI [...].

Resources may be available in multiple

representations (e.g. multiple

languages, data formats, size, and

resolutions) or vary in other ways.”

RFC 2616 (june 1999)

Page 21: APIDays - API Design Workshop

What’s a resource? Second attempt!Identify resources

“A resource is anything that’s important

enough to be referenced as a thing in itself.”

Leonard Richardson & Sam Ruby - “Restful Webservices”

Page 22: APIDays - API Design Workshop

Define operations

“Actions that can be performed on

your resources.

The most common operations are GET,

POST, PUT, PATCH and DELETE.”

What’s an operation?

Page 23: APIDays - API Design Workshop

/rides- GET- POST

/rides/{id}- GET- PUT- DELETE

Page 24: APIDays - API Design Workshop

Define responses

● Status code

● Representation

Page 25: APIDays - API Design Workshop

Define responses: HTTP status codes

1xx Hold on

2xx Here you go

3xx Go away

4xx You f**ked up

5xx I f**ked up

Page 26: APIDays - API Design Workshop

Define representation

● Data structure

● Formats

Page 27: APIDays - API Design Workshop

Define representation: formats

JSON

XML

YAML

JPGSVG

CSV

TEXT

PDF

MPEG

ZIP

Page 28: APIDays - API Design Workshop

Iterate on API Design

Page 29: APIDays - API Design Workshop

Document your API

Page 30: APIDays - API Design Workshop

Prepare documentation

● Add general information: endpoints, security, a picture

● Structure your API via sections

● Complete documentation with additional information on error handling and authentication

Page 31: APIDays - API Design Workshop

Publish your documentation

Page 32: APIDays - API Design Workshop

Move forward in your API project

Page 33: APIDays - API Design Workshop

Next steps

● Share your API design and get feedback on it

● Use Client SDK to speed up mobile app development

● Bootstrap your server code with Server Skeletons

● Export a Swagger file if you need to

Page 34: APIDays - API Design Workshop

Thanks for watching!

Thanks for participating!

Try studio.restlet.com and send us feedback!