SlideShare a Scribd company logo
AN IPHONE-PYTHON
                              LOVE AFFAIR
                             Building APIs for Mobile




Wednesday, June 8, 2011
Music Hack Day, February 2011




                                Samantha & Matt


Wednesday, June 8, 2011
ACCOMPLICE #1
                     Anna Callahan: iOS developer, jazz trumpet player
                                         @jazztpt
Wednesday, June 8, 2011
ACCOMPLICE #2
             Nate Aune: Django/Python/Plone developer, saxophonist
                                   @natea
Wednesday, June 8, 2011
VALENTUN.ES!




Wednesday, June 8, 2011
Wednesday, June 8, 2011
MOBILE TAKEOVER
                If you’re not building for mobile now, you will be soon.

Wednesday, June 8, 2011
WHAT’S DIFFERENT ABOUT
                   MOBILE?


    • Isn’t        REST appropriate for everything?

    • Don’t               I want a single API for all clients?




Wednesday, June 8, 2011
WHAT’S DIFFERENT ABOUT
                   MOBILE?
                          Mobile users are unwilling to wait.

       1. Connection = slow, spotty, or
         non-existent




       2. Mobile is not as powerful at
         fetching & saving data or calculations


Wednesday, June 8, 2011
SO YOUR API SHOULD

    • Return              hierarchies of related data

    • Authentication              and Authorization

    • Have            mobile-specific error codes & messages

    • Accept              arrays of related or unrelated data

    • Return              pre-calculated data or data that doesn’t exist on device


Wednesday, June 8, 2011
HIERARCHIES OF DATA

                          Bad :(        Good!

             Cards             Tracks




Wednesday, June 8, 2011
CARD CLASS




Wednesday, June 8, 2011
TRACK CLASS




Wednesday, June 8, 2011
SIMPLE REST API




                          Basic CRUD operations via API.
Wednesday, June 8, 2011
URLS.PY




   Now access cards and tracks with /api/card/ and /api/track/
Wednesday, June 8, 2011
CREATE A CARD




Wednesday, June 8, 2011
WHAT ABOUT TRACKS?




          Default post_list from resources.py (create object via POST)
Wednesday, June 8, 2011
WHAT ABOUT TRACKS?




                          api.py post_list (override method)

Wednesday, June 8, 2011
MOBILE WANTS
                          HIERARCHICAL DATA




Wednesday, June 8, 2011
TASTYPIE MAKES IT EASY




Wednesday, June 8, 2011
AUTHENTICATION &
                           AUTHORIZATION




                          Authentication - let the user in the door
                           Authorization - what the user can see
Wednesday, June 8, 2011
LIMITING BY USER




            Returns only the objects owned by the current user.


Wednesday, June 8, 2011
ERROR CODES

       Ideally your API should:

        •Never return HTML
        •Tailor response codes to actions on device
        •Return messages designed for the end user
        •Never, ever return HTML

Wednesday, June 8, 2011
JSON ERROR RESPONSES




                     override wrap_view from resources.py
Wednesday, June 8, 2011
JSON ERROR HANDLING




                          Objective-C in Xcode

Wednesday, June 8, 2011
Wednesday, June 8, 2011
ACCEPT ARRAYS OF DATA


    • User           enters tunnel

    • User           uses your app

    • User           closes your app

    • User           exits tunnel



Wednesday, June 8, 2011
PRE-CALCULATED DATA OR
           DATA NOT STORED ON
                 DEVICE

    • No   other users are stored
       on device

    • Leaderboards    or other
       calculated user data must
       come from the server



Wednesday, June 8, 2011
THANK YOU!

    • Music   Hack Day Accomplices: Matt Katz, Alexandre Passant,
       Jeff Novich, Twom Deryckere

    • Danielzilla         (Daniel Lindsley) - TastyPie

    • IsaacKelly

    • DjangoCon



Wednesday, June 8, 2011
MORE INFO

    • Valentun.es   live site
       http://valentun.es

    • Valentunes    (Django code)
       https://github.com/natea/valentunes

    • Valentunes    (iPhone code)
       https://github.com/jazztpt/Valentunes_iPhone

    • Valentunes    (Twilio integration)
       https://github.com/terraces/valentunes-twilio

Wednesday, June 8, 2011
DJANGO API FRAMEWORKS

    • TastyPie   documentation (the one we used)
       http://readthedocs.org/docs/django-tastypie/en/latest/

    • django-piston
       https://bitbucket.org/jespern/django-piston/

    • Django    REST framework
       http://django-rest-framework.org


Wednesday, June 8, 2011

More Related Content

Similar to iPhone Python love affair

Javascript Views, Client-side or Server-side with NodeJS
Javascript Views, Client-side or Server-side with NodeJSJavascript Views, Client-side or Server-side with NodeJS
Javascript Views, Client-side or Server-side with NodeJS
Sylvain Zimmer
 
2011 The Year of Web apps
2011 The Year of Web apps2011 The Year of Web apps
2011 The Year of Web apps
JungHyuk Kwon
 
A Look at the Future of HTML5
A Look at the Future of HTML5A Look at the Future of HTML5
A Look at the Future of HTML5
Tim Wright
 
Choosing the right Content Management System
Choosing the right Content Management SystemChoosing the right Content Management System
Choosing the right Content Management System
Rachel Andrew
 
2011 June - Singapore GTUG presentation. App Engine program update + intro to Go
2011 June - Singapore GTUG presentation. App Engine program update + intro to Go2011 June - Singapore GTUG presentation. App Engine program update + intro to Go
2011 June - Singapore GTUG presentation. App Engine program update + intro to Go
ikailan
 
Sinsai.info と Crisis Mapping
Sinsai.info と Crisis Mapping Sinsai.info と Crisis Mapping
Sinsai.info と Crisis Mapping
Hal Seki
 
Scaling atlassian os v4
Scaling atlassian os v4Scaling atlassian os v4
Scaling atlassian os v4
Soren Harner
 
Using+javascript+to+build+native+i os+applications
Using+javascript+to+build+native+i os+applicationsUsing+javascript+to+build+native+i os+applications
Using+javascript+to+build+native+i os+applications
Muhammad Ikram Ul Haq
 
Koss, How to make desktop caliber browser apps
Koss, How to make desktop caliber browser appsKoss, How to make desktop caliber browser apps
Koss, How to make desktop caliber browser apps
Evil Martians
 
LT 08 - Guilherme Silveira - Cache hipermidia
LT 08 - Guilherme Silveira - Cache hipermidiaLT 08 - Guilherme Silveira - Cache hipermidia
LT 08 - Guilherme Silveira - Cache hipermidia
DNAD
 
Mobility in the financial industry
Mobility in the financial industryMobility in the financial industry
Mobility in the financial industry
Vincent Everts
 
iPhone App from concept to product
iPhone App from concept to productiPhone App from concept to product
iPhone App from concept to product
joeysim
 
Messaging patterns
Messaging patternsMessaging patterns
Messaging patterns
Alvaro Videla
 
Atlassian RoadTrip 2011 Slide Deck
Atlassian RoadTrip 2011 Slide DeckAtlassian RoadTrip 2011 Slide Deck
Atlassian RoadTrip 2011 Slide Deck
Atlassian
 
Monitoring is easy, why are we so bad at it presentation
Monitoring is easy, why are we so bad at it  presentationMonitoring is easy, why are we so bad at it  presentation
Monitoring is easy, why are we so bad at it presentation
Theo Schlossnagle
 
Puppet camp europe 2011 hackability
Puppet camp europe 2011   hackabilityPuppet camp europe 2011   hackability
Puppet camp europe 2011 hackability
Puppet
 
Inspiratiemiddag_Vincent_Everts_Finalist generatie_einstein_komt_eraan_07042011
Inspiratiemiddag_Vincent_Everts_Finalist generatie_einstein_komt_eraan_07042011Inspiratiemiddag_Vincent_Everts_Finalist generatie_einstein_komt_eraan_07042011
Inspiratiemiddag_Vincent_Everts_Finalist generatie_einstein_komt_eraan_07042011
Finalist - open IT oplossingen
 
Einstein finalist.nl
Einstein finalist.nlEinstein finalist.nl
Einstein finalist.nl
Vincent Everts
 
Business of APIs Conference 2011 - YourTrove
Business of APIs Conference 2011 - YourTroveBusiness of APIs Conference 2011 - YourTrove
Business of APIs Conference 2011 - YourTrove
Mashery
 
Cochran - Mobile web 2 sms
Cochran - Mobile web 2 sms Cochran - Mobile web 2 sms
Cochran - Mobile web 2 sms
HR Florida State Council, Inc.
 

Similar to iPhone Python love affair (20)

Javascript Views, Client-side or Server-side with NodeJS
Javascript Views, Client-side or Server-side with NodeJSJavascript Views, Client-side or Server-side with NodeJS
Javascript Views, Client-side or Server-side with NodeJS
 
2011 The Year of Web apps
2011 The Year of Web apps2011 The Year of Web apps
2011 The Year of Web apps
 
A Look at the Future of HTML5
A Look at the Future of HTML5A Look at the Future of HTML5
A Look at the Future of HTML5
 
Choosing the right Content Management System
Choosing the right Content Management SystemChoosing the right Content Management System
Choosing the right Content Management System
 
2011 June - Singapore GTUG presentation. App Engine program update + intro to Go
2011 June - Singapore GTUG presentation. App Engine program update + intro to Go2011 June - Singapore GTUG presentation. App Engine program update + intro to Go
2011 June - Singapore GTUG presentation. App Engine program update + intro to Go
 
Sinsai.info と Crisis Mapping
Sinsai.info と Crisis Mapping Sinsai.info と Crisis Mapping
Sinsai.info と Crisis Mapping
 
Scaling atlassian os v4
Scaling atlassian os v4Scaling atlassian os v4
Scaling atlassian os v4
 
Using+javascript+to+build+native+i os+applications
Using+javascript+to+build+native+i os+applicationsUsing+javascript+to+build+native+i os+applications
Using+javascript+to+build+native+i os+applications
 
Koss, How to make desktop caliber browser apps
Koss, How to make desktop caliber browser appsKoss, How to make desktop caliber browser apps
Koss, How to make desktop caliber browser apps
 
LT 08 - Guilherme Silveira - Cache hipermidia
LT 08 - Guilherme Silveira - Cache hipermidiaLT 08 - Guilherme Silveira - Cache hipermidia
LT 08 - Guilherme Silveira - Cache hipermidia
 
Mobility in the financial industry
Mobility in the financial industryMobility in the financial industry
Mobility in the financial industry
 
iPhone App from concept to product
iPhone App from concept to productiPhone App from concept to product
iPhone App from concept to product
 
Messaging patterns
Messaging patternsMessaging patterns
Messaging patterns
 
Atlassian RoadTrip 2011 Slide Deck
Atlassian RoadTrip 2011 Slide DeckAtlassian RoadTrip 2011 Slide Deck
Atlassian RoadTrip 2011 Slide Deck
 
Monitoring is easy, why are we so bad at it presentation
Monitoring is easy, why are we so bad at it  presentationMonitoring is easy, why are we so bad at it  presentation
Monitoring is easy, why are we so bad at it presentation
 
Puppet camp europe 2011 hackability
Puppet camp europe 2011   hackabilityPuppet camp europe 2011   hackability
Puppet camp europe 2011 hackability
 
Inspiratiemiddag_Vincent_Everts_Finalist generatie_einstein_komt_eraan_07042011
Inspiratiemiddag_Vincent_Everts_Finalist generatie_einstein_komt_eraan_07042011Inspiratiemiddag_Vincent_Everts_Finalist generatie_einstein_komt_eraan_07042011
Inspiratiemiddag_Vincent_Everts_Finalist generatie_einstein_komt_eraan_07042011
 
Einstein finalist.nl
Einstein finalist.nlEinstein finalist.nl
Einstein finalist.nl
 
Business of APIs Conference 2011 - YourTrove
Business of APIs Conference 2011 - YourTroveBusiness of APIs Conference 2011 - YourTrove
Business of APIs Conference 2011 - YourTrove
 
Cochran - Mobile web 2 sms
Cochran - Mobile web 2 sms Cochran - Mobile web 2 sms
Cochran - Mobile web 2 sms
 

Recently uploaded

Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
shanihomely
 
Vulnerability Management: A Comprehensive Overview
Vulnerability Management: A Comprehensive OverviewVulnerability Management: A Comprehensive Overview
Vulnerability Management: A Comprehensive Overview
Steven Carlson
 
BLOCKCHAIN TECHNOLOGY - Advantages and Disadvantages
BLOCKCHAIN TECHNOLOGY - Advantages and DisadvantagesBLOCKCHAIN TECHNOLOGY - Advantages and Disadvantages
BLOCKCHAIN TECHNOLOGY - Advantages and Disadvantages
SAI KAILASH R
 
UX Webinar Series: Drive Revenue and Decrease Costs with Passkeys for Consume...
UX Webinar Series: Drive Revenue and Decrease Costs with Passkeys for Consume...UX Webinar Series: Drive Revenue and Decrease Costs with Passkeys for Consume...
UX Webinar Series: Drive Revenue and Decrease Costs with Passkeys for Consume...
FIDO Alliance
 
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
FIDO Alliance
 
Tailored CRM Software Development for Enhanced Customer Insights
Tailored CRM Software Development for Enhanced Customer InsightsTailored CRM Software Development for Enhanced Customer Insights
Tailored CRM Software Development for Enhanced Customer Insights
SynapseIndia
 
Opencast Summit 2024 — Opencast @ University of Münster
Opencast Summit 2024 — Opencast @ University of MünsterOpencast Summit 2024 — Opencast @ University of Münster
Opencast Summit 2024 — Opencast @ University of Münster
Matthias Neugebauer
 
Retrieval Augmented Generation Evaluation with Ragas
Retrieval Augmented Generation Evaluation with RagasRetrieval Augmented Generation Evaluation with Ragas
Retrieval Augmented Generation Evaluation with Ragas
Zilliz
 
Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...
Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...
Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...
Zilliz
 
Acumatica vs. Sage Intacct _Construction_July (1).pptx
Acumatica vs. Sage Intacct _Construction_July (1).pptxAcumatica vs. Sage Intacct _Construction_July (1).pptx
Acumatica vs. Sage Intacct _Construction_July (1).pptx
BrainSell Technologies
 
Step-By-Step Process to Develop a Mobile App From Scratch
Step-By-Step Process to Develop a Mobile App From ScratchStep-By-Step Process to Develop a Mobile App From Scratch
Step-By-Step Process to Develop a Mobile App From Scratch
softsuave
 
Connector Corner: Leveraging Snowflake Integration for Smarter Decision Making
Connector Corner: Leveraging Snowflake Integration for Smarter Decision MakingConnector Corner: Leveraging Snowflake Integration for Smarter Decision Making
Connector Corner: Leveraging Snowflake Integration for Smarter Decision Making
DianaGray10
 
The Path to General-Purpose Robots - Coatue
The Path to General-Purpose Robots - CoatueThe Path to General-Purpose Robots - Coatue
The Path to General-Purpose Robots - Coatue
Razin Mustafiz
 
leewayhertz.com-Generative AI tech stack Frameworks infrastructure models and...
leewayhertz.com-Generative AI tech stack Frameworks infrastructure models and...leewayhertz.com-Generative AI tech stack Frameworks infrastructure models and...
leewayhertz.com-Generative AI tech stack Frameworks infrastructure models and...
alexjohnson7307
 
Google I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged SlidesGoogle I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged Slides
Google Developer Group - Harare
 
Zaitechno Handheld Raman Spectrometer.pdf
Zaitechno Handheld Raman Spectrometer.pdfZaitechno Handheld Raman Spectrometer.pdf
Zaitechno Handheld Raman Spectrometer.pdf
AmandaCheung15
 
Gen AI: Privacy Risks of Large Language Models (LLMs)
Gen AI: Privacy Risks of Large Language Models (LLMs)Gen AI: Privacy Risks of Large Language Models (LLMs)
Gen AI: Privacy Risks of Large Language Models (LLMs)
Debmalya Biswas
 
Redefining Cybersecurity with AI Capabilities
Redefining Cybersecurity with AI CapabilitiesRedefining Cybersecurity with AI Capabilities
Redefining Cybersecurity with AI Capabilities
Priyanka Aash
 
Improving Learning Content Efficiency with Reusable Learning Content
Improving Learning Content Efficiency with Reusable Learning ContentImproving Learning Content Efficiency with Reusable Learning Content
Improving Learning Content Efficiency with Reusable Learning Content
Enterprise Knowledge
 
How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...
DianaGray10
 

Recently uploaded (20)

Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
 
Vulnerability Management: A Comprehensive Overview
Vulnerability Management: A Comprehensive OverviewVulnerability Management: A Comprehensive Overview
Vulnerability Management: A Comprehensive Overview
 
BLOCKCHAIN TECHNOLOGY - Advantages and Disadvantages
BLOCKCHAIN TECHNOLOGY - Advantages and DisadvantagesBLOCKCHAIN TECHNOLOGY - Advantages and Disadvantages
BLOCKCHAIN TECHNOLOGY - Advantages and Disadvantages
 
UX Webinar Series: Drive Revenue and Decrease Costs with Passkeys for Consume...
UX Webinar Series: Drive Revenue and Decrease Costs with Passkeys for Consume...UX Webinar Series: Drive Revenue and Decrease Costs with Passkeys for Consume...
UX Webinar Series: Drive Revenue and Decrease Costs with Passkeys for Consume...
 
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
 
Tailored CRM Software Development for Enhanced Customer Insights
Tailored CRM Software Development for Enhanced Customer InsightsTailored CRM Software Development for Enhanced Customer Insights
Tailored CRM Software Development for Enhanced Customer Insights
 
Opencast Summit 2024 — Opencast @ University of Münster
Opencast Summit 2024 — Opencast @ University of MünsterOpencast Summit 2024 — Opencast @ University of Münster
Opencast Summit 2024 — Opencast @ University of Münster
 
Retrieval Augmented Generation Evaluation with Ragas
Retrieval Augmented Generation Evaluation with RagasRetrieval Augmented Generation Evaluation with Ragas
Retrieval Augmented Generation Evaluation with Ragas
 
Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...
Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...
Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...
 
Acumatica vs. Sage Intacct _Construction_July (1).pptx
Acumatica vs. Sage Intacct _Construction_July (1).pptxAcumatica vs. Sage Intacct _Construction_July (1).pptx
Acumatica vs. Sage Intacct _Construction_July (1).pptx
 
Step-By-Step Process to Develop a Mobile App From Scratch
Step-By-Step Process to Develop a Mobile App From ScratchStep-By-Step Process to Develop a Mobile App From Scratch
Step-By-Step Process to Develop a Mobile App From Scratch
 
Connector Corner: Leveraging Snowflake Integration for Smarter Decision Making
Connector Corner: Leveraging Snowflake Integration for Smarter Decision MakingConnector Corner: Leveraging Snowflake Integration for Smarter Decision Making
Connector Corner: Leveraging Snowflake Integration for Smarter Decision Making
 
The Path to General-Purpose Robots - Coatue
The Path to General-Purpose Robots - CoatueThe Path to General-Purpose Robots - Coatue
The Path to General-Purpose Robots - Coatue
 
leewayhertz.com-Generative AI tech stack Frameworks infrastructure models and...
leewayhertz.com-Generative AI tech stack Frameworks infrastructure models and...leewayhertz.com-Generative AI tech stack Frameworks infrastructure models and...
leewayhertz.com-Generative AI tech stack Frameworks infrastructure models and...
 
Google I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged SlidesGoogle I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged Slides
 
Zaitechno Handheld Raman Spectrometer.pdf
Zaitechno Handheld Raman Spectrometer.pdfZaitechno Handheld Raman Spectrometer.pdf
Zaitechno Handheld Raman Spectrometer.pdf
 
Gen AI: Privacy Risks of Large Language Models (LLMs)
Gen AI: Privacy Risks of Large Language Models (LLMs)Gen AI: Privacy Risks of Large Language Models (LLMs)
Gen AI: Privacy Risks of Large Language Models (LLMs)
 
Redefining Cybersecurity with AI Capabilities
Redefining Cybersecurity with AI CapabilitiesRedefining Cybersecurity with AI Capabilities
Redefining Cybersecurity with AI Capabilities
 
Improving Learning Content Efficiency with Reusable Learning Content
Improving Learning Content Efficiency with Reusable Learning ContentImproving Learning Content Efficiency with Reusable Learning Content
Improving Learning Content Efficiency with Reusable Learning Content
 
How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...
 

iPhone Python love affair

  • 1. AN IPHONE-PYTHON LOVE AFFAIR Building APIs for Mobile Wednesday, June 8, 2011
  • 2. Music Hack Day, February 2011 Samantha & Matt Wednesday, June 8, 2011
  • 3. ACCOMPLICE #1 Anna Callahan: iOS developer, jazz trumpet player @jazztpt Wednesday, June 8, 2011
  • 4. ACCOMPLICE #2 Nate Aune: Django/Python/Plone developer, saxophonist @natea Wednesday, June 8, 2011
  • 7. MOBILE TAKEOVER If you’re not building for mobile now, you will be soon. Wednesday, June 8, 2011
  • 8. WHAT’S DIFFERENT ABOUT MOBILE? • Isn’t REST appropriate for everything? • Don’t I want a single API for all clients? Wednesday, June 8, 2011
  • 9. WHAT’S DIFFERENT ABOUT MOBILE? Mobile users are unwilling to wait. 1. Connection = slow, spotty, or non-existent 2. Mobile is not as powerful at fetching & saving data or calculations Wednesday, June 8, 2011
  • 10. SO YOUR API SHOULD • Return hierarchies of related data • Authentication and Authorization • Have mobile-specific error codes & messages • Accept arrays of related or unrelated data • Return pre-calculated data or data that doesn’t exist on device Wednesday, June 8, 2011
  • 11. HIERARCHIES OF DATA Bad :( Good! Cards Tracks Wednesday, June 8, 2011
  • 14. SIMPLE REST API Basic CRUD operations via API. Wednesday, June 8, 2011
  • 15. URLS.PY Now access cards and tracks with /api/card/ and /api/track/ Wednesday, June 8, 2011
  • 16. CREATE A CARD Wednesday, June 8, 2011
  • 17. WHAT ABOUT TRACKS? Default post_list from resources.py (create object via POST) Wednesday, June 8, 2011
  • 18. WHAT ABOUT TRACKS? api.py post_list (override method) Wednesday, June 8, 2011
  • 19. MOBILE WANTS HIERARCHICAL DATA Wednesday, June 8, 2011
  • 20. TASTYPIE MAKES IT EASY Wednesday, June 8, 2011
  • 21. AUTHENTICATION & AUTHORIZATION Authentication - let the user in the door Authorization - what the user can see Wednesday, June 8, 2011
  • 22. LIMITING BY USER Returns only the objects owned by the current user. Wednesday, June 8, 2011
  • 23. ERROR CODES Ideally your API should: •Never return HTML •Tailor response codes to actions on device •Return messages designed for the end user •Never, ever return HTML Wednesday, June 8, 2011
  • 24. JSON ERROR RESPONSES override wrap_view from resources.py Wednesday, June 8, 2011
  • 25. JSON ERROR HANDLING Objective-C in Xcode Wednesday, June 8, 2011
  • 27. ACCEPT ARRAYS OF DATA • User enters tunnel • User uses your app • User closes your app • User exits tunnel Wednesday, June 8, 2011
  • 28. PRE-CALCULATED DATA OR DATA NOT STORED ON DEVICE • No other users are stored on device • Leaderboards or other calculated user data must come from the server Wednesday, June 8, 2011
  • 29. THANK YOU! • Music Hack Day Accomplices: Matt Katz, Alexandre Passant, Jeff Novich, Twom Deryckere • Danielzilla (Daniel Lindsley) - TastyPie • IsaacKelly • DjangoCon Wednesday, June 8, 2011
  • 30. MORE INFO • Valentun.es live site http://valentun.es • Valentunes (Django code) https://github.com/natea/valentunes • Valentunes (iPhone code) https://github.com/jazztpt/Valentunes_iPhone • Valentunes (Twilio integration) https://github.com/terraces/valentunes-twilio Wednesday, June 8, 2011
  • 31. DJANGO API FRAMEWORKS • TastyPie documentation (the one we used) http://readthedocs.org/docs/django-tastypie/en/latest/ • django-piston https://bitbucket.org/jespern/django-piston/ • Django REST framework http://django-rest-framework.org Wednesday, June 8, 2011