SlideShare uma empresa Scribd logo
1 de 18
3 things your app API is doing
WRONG
Robert MacLean  @rmaclean
Introduction
 I’m Robert
 that is all you get, I have 18 slides to get through
 Not covering the obvious (security, validate input, use REST etc…)
 Do this regardless if you plan for apps or not
Be agnostic
 REST won
 REST is about HTTP
 Stop pushing your C#, PHP or JavaScript views on the world
 Tip: SQLite data structures
Be agnostic – bad
example 1
[{
“title”: {
“en”: ”this is an awesome talk”
}
}]
[{
“title”: {
“fr”: ”Il s'agit d'un discours génial”
}
}]
Magically appearing properties.
Assumption of dynamic languages &
objects
Be agnostic – good
example 1 [{
“title”: {
“value”: ”this is an awesome talk”,
“lang”:”en”
}
}]Be consistent and state intent
Be agnostic – bad
example 2
[{
“data”: [
{
“user”:”paul smith”,
“id”:12,
“type”:”actor”
},
{
“title”:”theseus”,
“id”:232,
“type”:”game”
},
{
“delete”:1,
“id”:12,
“type”:”actor”
}]
}]
Arrays that contain different types
Be agnostic – good
example 2
[{
“actors”: [
{
“user”:”paul smith”,
“id”:12,
}],
“games”: [
{
“title”:”theseus”,
“id”:232,
}],
“deleted”: [
{
“id”:12,
“type”:”actor”
}]
}]
Separate arrays or totally separate
calls would be good.
Identify and respond
 Your API should allow the app to say what type of app it is
 Do not expect technical information
 Respond accordingly to the identity
Identify– bad example
[{“user”:”1234”}]
[{“user”:”1234”, “deviceId”:”76879902”}]
[{“user”:”1234”,
“deviceId”:”76879902”,”wresolution”:480,”hresolu
tion”:800}]
1. Assuming user without device
2. No device identification info
3. Asking for technical information
Identify – good example [{
“user”:”1234”,
“deviceId”:”76879902”,
”os”:”windows”,
”platform”:”phone”,
”resolution”:”medium”
}]
Using sets of identifiers which are not
fixed to hardware details
Respond – bad example
[{
“image”:{
“50x50”: “http://fqdn/image50x50.png”,
“400x400”: “http://fqdn/image400x400.png”,
}
}]
1. Fixed content regardless of device
2. Same respond data type
Respond – good example
[{
“image”:{
“thumbnail”: “http://fqdn/image50x50.png”,
“image”: “http://fqdn/image400x400.png”,
}
}]
<image thumbnail=“http://fqdn/image50x50.png”
image=“http://fqdn/image400x400.png” />
1. Provide data based on info
2. Different data types
Send more data
 Send data that isn’t shown
 Send data that has been computed already
 Send data in raw formats
Send more data – bad
example 1
[{
“videos”:[
“1”:”http://fqdn/video1.mp4”,
“2”:”http://fqdn/video2.mp4”,
]
}]
Out of band:
 Adverts can’t be skipped
 Advert is any clip less than 30sec
Send data that isn’t shown
Send data that has been computed
already
Send more data – good
example 1
[{
“videos”:[
{
“id”: “1”,
“url”: “http://fqdn/video1.mp4”,
“isAdvert”: “false”,
“hash”:”8736426348726387462123123123”
},
{
“id”: “2”,
“url”: “http://fqdn/video2.mp4”,
“isAdvert”: “true”,
“hash”:”8739487298734987329847298343”
}
]
}]
Send data that isn’t shown
Send data that has been computed
already
Send more data – bad
example 1
[{
“description”:”<h1>Jump by Van Halen</h1><div
class=‘artist’ id=‘1’>Van Halen</div><div
class=‘title’ id=‘9000’>Jump</div><div
class=‘content’>Jump is a song by the American
rock group Van Halen. It was released in
December 1983 as the lead single from their
album 1984. It is the only single the group
released in their career to reach number one on
the U.S. Billboard Hot 100.</div>
}]
Send the raw data
Send more data – good
example 1
[{
“title”:”Jump by Van Halen”,
“artist”:1,
“title”:9000,
“description”:”Jump is a song by the American
rock group Van Halen. It was released in
December 1983 as the lead single from their
album 1984. It is the only single the group
released in their career to reach number one on
the U.S. Billboard Hot 100.”
}]
Send the raw data.
Identify and respond works here too.
Thanks
 Be agnostic
 Identify and respond
 Send more data
@rmaclean
www.sadev.co.za

Mais conteúdo relacionado

Semelhante a 3 things your app API is doing WRONG

Smx Milano 2014 Semantic SEO with Schema.org
Smx Milano 2014 Semantic SEO with Schema.orgSmx Milano 2014 Semantic SEO with Schema.org
Smx Milano 2014 Semantic SEO with Schema.org
Sante J. Achille
 
Как не нужно писать Gherkin сценарии
Как не нужно писать Gherkin сценарииКак не нужно писать Gherkin сценарии
Как не нужно писать Gherkin сценарии
Andrii Dzynia
 
[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design
Christopher Schmitt
 
Being a tweaker modern web performance techniques
Being a tweaker   modern web performance techniquesBeing a tweaker   modern web performance techniques
Being a tweaker modern web performance techniques
Chris Love
 

Semelhante a 3 things your app API is doing WRONG (20)

Loopback presentation by tineco
Loopback presentation by tinecoLoopback presentation by tineco
Loopback presentation by tineco
 
IBM Connections Activity Stream 3rd Party Integration - Social Connect VI - P...
IBM Connections Activity Stream 3rd Party Integration - Social Connect VI - P...IBM Connections Activity Stream 3rd Party Integration - Social Connect VI - P...
IBM Connections Activity Stream 3rd Party Integration - Social Connect VI - P...
 
Speak The Web: The HTML5 Experiments
Speak The Web: The HTML5 ExperimentsSpeak The Web: The HTML5 Experiments
Speak The Web: The HTML5 Experiments
 
apidays LIVE Australia 2021 - API Horror Stories from an Unnamed Coworking Co...
apidays LIVE Australia 2021 - API Horror Stories from an Unnamed Coworking Co...apidays LIVE Australia 2021 - API Horror Stories from an Unnamed Coworking Co...
apidays LIVE Australia 2021 - API Horror Stories from an Unnamed Coworking Co...
 
Smx Milano 2014 Semantic SEO with Schema.org
Smx Milano 2014 Semantic SEO with Schema.orgSmx Milano 2014 Semantic SEO with Schema.org
Smx Milano 2014 Semantic SEO with Schema.org
 
IBM Connections Activity Stream APIs - Lab Dec 2012
IBM Connections Activity Stream APIs - Lab Dec 2012IBM Connections Activity Stream APIs - Lab Dec 2012
IBM Connections Activity Stream APIs - Lab Dec 2012
 
Petr Dvořák: Mobilní webové služby pohledem iPhone developera
Petr Dvořák: Mobilní webové služby pohledem iPhone developeraPetr Dvořák: Mobilní webové služby pohledem iPhone developera
Petr Dvořák: Mobilní webové služby pohledem iPhone developera
 
- Webexpo 2010
- Webexpo 2010- Webexpo 2010
- Webexpo 2010
 
Walking Down the A11y Road - Lessons Learned from Working on Accessibility of...
Walking Down the A11y Road - Lessons Learned from Working on Accessibility of...Walking Down the A11y Road - Lessons Learned from Working on Accessibility of...
Walking Down the A11y Road - Lessons Learned from Working on Accessibility of...
 
apidays LIVE London 2021 - API Horror Stories from an Unnamed Coworking Compa...
apidays LIVE London 2021 - API Horror Stories from an Unnamed Coworking Compa...apidays LIVE London 2021 - API Horror Stories from an Unnamed Coworking Compa...
apidays LIVE London 2021 - API Horror Stories from an Unnamed Coworking Compa...
 
Introduction to threat_modeling
Introduction to threat_modelingIntroduction to threat_modeling
Introduction to threat_modeling
 
Как не нужно писать Gherkin сценарии
Как не нужно писать Gherkin сценарииКак не нужно писать Gherkin сценарии
Как не нужно писать Gherkin сценарии
 
The top 10 security issues in web applications
The top 10 security issues in web applicationsThe top 10 security issues in web applications
The top 10 security issues in web applications
 
Graphics & Animation with HTML5
Graphics & Animation with HTML5Graphics & Animation with HTML5
Graphics & Animation with HTML5
 
Mixpanel
MixpanelMixpanel
Mixpanel
 
[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design
 
Bases de Datos NoSQL
Bases de Datos NoSQL Bases de Datos NoSQL
Bases de Datos NoSQL
 
HTML5 and CSS3 Shizzle
HTML5 and CSS3 ShizzleHTML5 and CSS3 Shizzle
HTML5 and CSS3 Shizzle
 
Being a tweaker modern web performance techniques
Being a tweaker   modern web performance techniquesBeing a tweaker   modern web performance techniques
Being a tweaker modern web performance techniques
 
Developing Secure Software: Experiences From an International Software Vendor
Developing Secure Software: Experiences From an International Software VendorDeveloping Secure Software: Experiences From an International Software Vendor
Developing Secure Software: Experiences From an International Software Vendor
 

Mais de Robert MacLean

Mais de Robert MacLean (20)

14 things you need to be a successful software developer (v3)
14 things you need to be a successful software developer (v3)14 things you need to be a successful software developer (v3)
14 things you need to be a successful software developer (v3)
 
Git
GitGit
Git
 
OWASP TOP 10
OWASP TOP 10OWASP TOP 10
OWASP TOP 10
 
Building a µservice with Kotlin, Micronaut & GCP
Building a µservice with Kotlin, Micronaut & GCPBuilding a µservice with Kotlin, Micronaut & GCP
Building a µservice with Kotlin, Micronaut & GCP
 
Looking at the Vue
Looking at the VueLooking at the Vue
Looking at the Vue
 
Kotlin 101
Kotlin 101Kotlin 101
Kotlin 101
 
Features of Kotlin I find exciting
Features of Kotlin I find excitingFeatures of Kotlin I find exciting
Features of Kotlin I find exciting
 
JavaScript Gotchas
JavaScript GotchasJavaScript Gotchas
JavaScript Gotchas
 
DevConf Survival Guide
DevConf Survival GuideDevConf Survival Guide
DevConf Survival Guide
 
The state of testing @ Microsoft
The state of testing @ MicrosoftThe state of testing @ Microsoft
The state of testing @ Microsoft
 
Visual Studio ❤ JavaScript
Visual Studio ❤ JavaScriptVisual Studio ❤ JavaScript
Visual Studio ❤ JavaScript
 
What is new in C# 6?
What is new in C# 6?What is new in C# 6?
What is new in C# 6?
 
Putting the DOT in .NET - Dev/Ops/Test
Putting the DOT in .NET - Dev/Ops/TestPutting the DOT in .NET - Dev/Ops/Test
Putting the DOT in .NET - Dev/Ops/Test
 
A Developer Day 2014 - Durban
A Developer Day 2014 - Durban A Developer Day 2014 - Durban
A Developer Day 2014 - Durban
 
ASP.NET
ASP.NETASP.NET
ASP.NET
 
LightSwitch
LightSwitchLightSwitch
LightSwitch
 
How to build a Mobile API or HTML 5 app in 5 minutes
How to build a Mobile API or HTML 5 app in 5 minutesHow to build a Mobile API or HTML 5 app in 5 minutes
How to build a Mobile API or HTML 5 app in 5 minutes
 
Protection of Personal Information Bill (POPI)
Protection of Personal Information Bill (POPI)Protection of Personal Information Bill (POPI)
Protection of Personal Information Bill (POPI)
 
Open Source Licensing
Open Source LicensingOpen Source Licensing
Open Source Licensing
 
How to give a great presentation
How to give a great presentationHow to give a great presentation
How to give a great presentation
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Último (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

3 things your app API is doing WRONG

  • 1. 3 things your app API is doing WRONG Robert MacLean  @rmaclean
  • 2. Introduction  I’m Robert  that is all you get, I have 18 slides to get through  Not covering the obvious (security, validate input, use REST etc…)  Do this regardless if you plan for apps or not
  • 3. Be agnostic  REST won  REST is about HTTP  Stop pushing your C#, PHP or JavaScript views on the world  Tip: SQLite data structures
  • 4. Be agnostic – bad example 1 [{ “title”: { “en”: ”this is an awesome talk” } }] [{ “title”: { “fr”: ”Il s'agit d'un discours génial” } }] Magically appearing properties. Assumption of dynamic languages & objects
  • 5. Be agnostic – good example 1 [{ “title”: { “value”: ”this is an awesome talk”, “lang”:”en” } }]Be consistent and state intent
  • 6. Be agnostic – bad example 2 [{ “data”: [ { “user”:”paul smith”, “id”:12, “type”:”actor” }, { “title”:”theseus”, “id”:232, “type”:”game” }, { “delete”:1, “id”:12, “type”:”actor” }] }] Arrays that contain different types
  • 7. Be agnostic – good example 2 [{ “actors”: [ { “user”:”paul smith”, “id”:12, }], “games”: [ { “title”:”theseus”, “id”:232, }], “deleted”: [ { “id”:12, “type”:”actor” }] }] Separate arrays or totally separate calls would be good.
  • 8. Identify and respond  Your API should allow the app to say what type of app it is  Do not expect technical information  Respond accordingly to the identity
  • 9. Identify– bad example [{“user”:”1234”}] [{“user”:”1234”, “deviceId”:”76879902”}] [{“user”:”1234”, “deviceId”:”76879902”,”wresolution”:480,”hresolu tion”:800}] 1. Assuming user without device 2. No device identification info 3. Asking for technical information
  • 10. Identify – good example [{ “user”:”1234”, “deviceId”:”76879902”, ”os”:”windows”, ”platform”:”phone”, ”resolution”:”medium” }] Using sets of identifiers which are not fixed to hardware details
  • 11. Respond – bad example [{ “image”:{ “50x50”: “http://fqdn/image50x50.png”, “400x400”: “http://fqdn/image400x400.png”, } }] 1. Fixed content regardless of device 2. Same respond data type
  • 12. Respond – good example [{ “image”:{ “thumbnail”: “http://fqdn/image50x50.png”, “image”: “http://fqdn/image400x400.png”, } }] <image thumbnail=“http://fqdn/image50x50.png” image=“http://fqdn/image400x400.png” /> 1. Provide data based on info 2. Different data types
  • 13. Send more data  Send data that isn’t shown  Send data that has been computed already  Send data in raw formats
  • 14. Send more data – bad example 1 [{ “videos”:[ “1”:”http://fqdn/video1.mp4”, “2”:”http://fqdn/video2.mp4”, ] }] Out of band:  Adverts can’t be skipped  Advert is any clip less than 30sec Send data that isn’t shown Send data that has been computed already
  • 15. Send more data – good example 1 [{ “videos”:[ { “id”: “1”, “url”: “http://fqdn/video1.mp4”, “isAdvert”: “false”, “hash”:”8736426348726387462123123123” }, { “id”: “2”, “url”: “http://fqdn/video2.mp4”, “isAdvert”: “true”, “hash”:”8739487298734987329847298343” } ] }] Send data that isn’t shown Send data that has been computed already
  • 16. Send more data – bad example 1 [{ “description”:”<h1>Jump by Van Halen</h1><div class=‘artist’ id=‘1’>Van Halen</div><div class=‘title’ id=‘9000’>Jump</div><div class=‘content’>Jump is a song by the American rock group Van Halen. It was released in December 1983 as the lead single from their album 1984. It is the only single the group released in their career to reach number one on the U.S. Billboard Hot 100.</div> }] Send the raw data
  • 17. Send more data – good example 1 [{ “title”:”Jump by Van Halen”, “artist”:1, “title”:9000, “description”:”Jump is a song by the American rock group Van Halen. It was released in December 1983 as the lead single from their album 1984. It is the only single the group released in their career to reach number one on the U.S. Billboard Hot 100.” }] Send the raw data. Identify and respond works here too.
  • 18. Thanks  Be agnostic  Identify and respond  Send more data @rmaclean www.sadev.co.za