Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

Practical Tips for RESTful APIs

No description
by

Chris Latimer

on 4 September 2014

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Practical Tips for RESTful APIs

Start with the Basics
Who
is going to use your API?

Why
are they going to use your API?

What
do you need to provide to meet the needs of your consumers?

How
will you design and implement your API?

RESTful API Design

What's Useful to the Developer?
Product Information
- pictures, specs, and everything needed to sell the products

Plan Information
- everything to tell customers what they will be charged

Close the Deal
- a simple way to sign the customer up for X-Mobile's service and purchase a device

Easy to Consume Format
- JSON, maybe XML

Easy to Use Authentication
- API Key, Message Digests
Sketch your Resources
Now What?
Resources
- Sketch your endpoints and data structures

Wireframes
- Mock up an example app and validate your API

Iterate
- Until you can write an app using your API

Decide
- On low level approaches to things like versioning & security

Develop
- Red, Green, Refactor until you have a working API!
For Example
Better Get Started
Who?
External Application Developers

Why?
Earn commission

What?
Product information, business process logic

How?
That's a good question
{
"author": "Chris Latimer",
"goal": "Create Useful APIs",
"contact": "@chrislatimer"
}

X-Mobile CEO:
I want the whole world to be our sales team. Let anyone sell our phones!
You:
We aren't really set up for that, sir.
X-Mobile CEO:
Just make it happen. You have 2 weeks.
Start with the most probable resources you'll need:
Phones
Plans

Note other possible resources, but don't get paralyzed:
Devices
Tablets
Customers

Progress >>
Perfection
Sketch Your Endpoints
Phone JSON
GET /phones

[
{
"id":1,
"name": "Samsung Galaxy S4"
},
{
"id":2,
"name": "HTC One"
}
]
Could you build an app with just this?
Mockup an App
Phone List
Phone Details
Phone Details
Refine Your Data
GET /phones
[
{
"id":123
"name": "Samsung Galaxy S4",
"listPrice": 549.00,
"description":"Introducing the..."
"images":["http://...","http://..."].
"links":[
{"rel":"self","uri":"phones/123"},
{"rel":"reviews","uri":"phones/123/reviews"}]
},
{
"id":124,
"name": "HTC One"
...
}
]
Are You Ready to Build?
Not so fast, what about?
What's Next?
Let's Build It!
Groovy/Grails Implementation
Ruby on Rails Implementation
All Code Provided on GitHub
Look for Blog Posts on http://groovyc.net

How Will
Developers:
Retrieve the data they need to sell phones?
Execute the business process steps to convert a customer to X-Mobile?
Get credit for their sales?
These answers ensure your API is
viable
and
functional
How Will Developers:
Gain access to the API?
Learn how the API works?
Consume the API?
How Will You:
These answers ensure your API has a clear
adoption path
Secure your API?
Version your API?
Expose different data formats?
Implement error handling?
Test your API?
Scale your API?
These answers ensure your API is built on a
solid foundation
Versioning
URL Based:
v1/phones/123

Header Based:
Accept-Version: 1.0

Parameter Based:
/phones/123?version=1.0
Security
Authentication/Authorization

Transport Layer Security

Attack Prevention

Attack Detection
Consistency
Parameter Names

Default Values

Response Structure

Error Handling
Example API
Design Decisions
$500
$350
Keep Iterating Until Things Stabilize
What Makes an API Useful?
How Do You Design a Useful API?
How Do You Build a Useful API
Practical Tips for Creating a Useful API
Full transcript