SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Downloaden Sie, um offline zu lesen
Easy APIs to Make Your Work
           Easier
Or, an opportunity to make obscure '80s
              references


                    Eric Mattison
               Senior Web Developer
  FAS Informatics and Scientific Applicaitons Group
Earthquake



This presentation is going to feature lots of
  live demos. Something is bound to go
         horribly, horribly wrong.

               And I feel fine.
I want my
                       MTV
                  (Dude, that's Sting singing backing vocals
                               for Dire Straits!)



  In his talk “Your Models for Nothing and
Your Admin for Free” Raman Prasad showed
      us the wonderful world of Django.
      (https://www.djangoproject.com/)

   Terminology Note: Django is a “Model-Template-View”
framework. Which may or may not be more understandable
   than a “Model-View-Controller” framework. But they're
 essentially the same thing. I believe the creators of Django
  chose “Model-Template-View” purely as a paean to MTV.
Sweet Child
                of Mine



I'm going to be talking about creating APIs
         for Django using Tastypie.
      (http://django-tastypie.readthedocs.org)
My
                   Prerogative

  However, you should use whatever you feel comfortable
 with. Just make sure you're using a Model-View-Controller
Framework that has a REST plugin or supports REST natively.
                            e.g.:

                     CakePHP: Native
                  Symfony: FOSRestBundle
                   Ruby on Rails: Native
                      Spring: JAX-RS
                    Struts: REST Plugin
            (and winner of the most creative plugin name)
Put Your
             Hands Up
           (sorry, not an '80s reference)




Who here has added an API to an application?


    Have any of you had to write an API?


                   Fun, yeah?
Ok, fine. Let's look at a simple example.
Mony Mony
Well, How
               did I get
                here?

           The Story of SPINAL
(Scheduling & Payments for Instruments and
               Laboratories)
  BTW: Raise your hand if you've worked on a
         massive development project
We Built
                This City
                The Good:
     - Avoids scheduling conflicts for 220+
         instruments 2000+ researchers
 - Provides user permission management for
               instrument “owners”
- Allows lab admins to assign expense codes
    to researchers for the use of instruments
    - Generates monthly invoices based on
            frankly insane billing rules
Welcome to
            the Jungle

              The Arrgh:
 - SPINAL is (necessarily) complex: 111+
database tables, 100,000+ lines of code,
                   which...
       - Makes upgrades difficult to QA
  - Takes a long time to build and deploy
    - Slows down the development cycle
One Thing
                    Leads to
                    Another
                      The Fixx:
Much later, a facility administrator asked me
 to create a publicly available calendar for
certain instruments. Rather than build more
 functionality into SPINAL, I created a new
    application that used data already in
                    SPINAL.
 https://webapps.sciences.fas.harvard.edu/gw-schedule/
          (same server, different application)
You
               Dropped a
              Bomb on Me
Installing Tastypie meant that I didn't have to
write the APIs myself. And yet, I will take the
                     credit.

 Well, I'll also mention Phil Durbin. He told
   me about Tastypie in the first place.
                  Thanks, Phil.
Smell the
   Glove
SPINAL + TastyPie =
Let's Dance


                      Here's the output:
https://webapps.sciences.fas.harvard.edu/spinal/api/v1/reservation/?format=json



The Glasswash Schedule application reads
 the data from SPINAL and formats it for
             calendar display.
What I Like
           About You

          - Don't Repeat Yourself
  - Less Code → Easier to understand
  - More contained → Easier to deploy
  - Fewer functions → Easier to debug
- Serialization → Multi-platform support
     - Ajaxian → Is that even a word?
   - Unixian → What does this mean?
Video Killed
                        the Radio
                           Star
                       An aside on the greatness of
                              Bruce Molay


 The best course I took at Harvard Extension
   was CSCI E-113 taught by Bruce Molay
(http://www.extension.harvard.edu/about-us/faculty-directory/bruce-molay)

   The course was about how to chain very
 simple Unix tools to build a web server. Web
     APIs hold the promise to make web
     applications function the same way.
Back on the
               Chain Gang
                     Just as
   cal | head -n 5 | tail -n 1 | cut -d ' ' -f 5


 should get you the third Thursday of the
month, we should be able to “pipe” one web
         application into another:
     JSON   Billing App    Document App   PDF
Hell to Pay
We are
                      Family

 Schools, Departments, Divisions have different needs.
Enterprise applications that meet everyone's requirements
 are time-consuming, costly, complex and are frequently
       loathed by the people that have to use them.

   A federated approach to software development suits
Harvard's organization better. Smaller programs can focus
 on doing one thing well. Creating sensible APIs for these
programs can turn them into building blocks that anyone at
             Harvard (and beyond) can use.
Gimme All
Your Lovin'




 I Thank You
Talk to Me




The Question & Answer Part

    Also, beer at John Harvard's

Weitere ähnliche Inhalte

Ähnlich wie Tastypie: Easy APIs to Make Your Work Easier

Ähnlich wie Tastypie: Easy APIs to Make Your Work Easier (20)

Web Hooks
Web HooksWeb Hooks
Web Hooks
 
Building a full-stack app with Golang and Google Cloud Platform in one week
Building a full-stack app with Golang and Google Cloud Platform in one weekBuilding a full-stack app with Golang and Google Cloud Platform in one week
Building a full-stack app with Golang and Google Cloud Platform in one week
 
Teaching Elephants to Dance (and Fly!) A Developer's Journey to Digital Trans...
Teaching Elephants to Dance (and Fly!) A Developer's Journey to Digital Trans...Teaching Elephants to Dance (and Fly!) A Developer's Journey to Digital Trans...
Teaching Elephants to Dance (and Fly!) A Developer's Journey to Digital Trans...
 
Expo - Zero to App.pptx
Expo - Zero to App.pptxExpo - Zero to App.pptx
Expo - Zero to App.pptx
 
Dictionary Within the Cloud
Dictionary Within the CloudDictionary Within the Cloud
Dictionary Within the Cloud
 
Mobile application development platform
Mobile application development platformMobile application development platform
Mobile application development platform
 
Donald Ferguson - Old Programmers Can Learn New Tricks
Donald Ferguson - Old Programmers Can Learn New TricksDonald Ferguson - Old Programmers Can Learn New Tricks
Donald Ferguson - Old Programmers Can Learn New Tricks
 
2017 03 25 Microsoft Hacks, How to code efficiently
2017 03 25 Microsoft Hacks, How to code efficiently2017 03 25 Microsoft Hacks, How to code efficiently
2017 03 25 Microsoft Hacks, How to code efficiently
 
[RHFSeoul2017]6 Steps to Transform Enterprise Applications
[RHFSeoul2017]6 Steps to Transform Enterprise Applications[RHFSeoul2017]6 Steps to Transform Enterprise Applications
[RHFSeoul2017]6 Steps to Transform Enterprise Applications
 
Angular js mobile jsday 2014 - Verona 14 may
Angular js mobile   jsday 2014 - Verona 14 mayAngular js mobile   jsday 2014 - Verona 14 may
Angular js mobile jsday 2014 - Verona 14 may
 
Presentation of programming languages for beginners
Presentation of programming languages for beginnersPresentation of programming languages for beginners
Presentation of programming languages for beginners
 
DiUS Computing Lca Rails Final
DiUS  Computing Lca Rails FinalDiUS  Computing Lca Rails Final
DiUS Computing Lca Rails Final
 
Ruby On Rails Presentation
Ruby On Rails PresentationRuby On Rails Presentation
Ruby On Rails Presentation
 
Offline of web applications
Offline of web applicationsOffline of web applications
Offline of web applications
 
Offline for web - Frontend Dev Conf Minsk 2014
Offline for web - Frontend Dev Conf Minsk 2014Offline for web - Frontend Dev Conf Minsk 2014
Offline for web - Frontend Dev Conf Minsk 2014
 
Is Enterprise Java Still Relevant (JavaOne 2015 session)
Is Enterprise Java Still Relevant (JavaOne 2015 session)Is Enterprise Java Still Relevant (JavaOne 2015 session)
Is Enterprise Java Still Relevant (JavaOne 2015 session)
 
AWS Tech Summit - Berlin 2011 - Running Java Applications on AWS
AWS Tech Summit - Berlin 2011 - Running Java Applications on AWSAWS Tech Summit - Berlin 2011 - Running Java Applications on AWS
AWS Tech Summit - Berlin 2011 - Running Java Applications on AWS
 
The Power of a Great API
The Power of a Great APIThe Power of a Great API
The Power of a Great API
 
Extending DevOps to Big Data Applications with Kubernetes
Extending DevOps to Big Data Applications with KubernetesExtending DevOps to Big Data Applications with Kubernetes
Extending DevOps to Big Data Applications with Kubernetes
 
Dean4j@Njug5
Dean4j@Njug5Dean4j@Njug5
Dean4j@Njug5
 

Mehr von Harvard Web Working Group

UX @ Harvard's IQSS (Elizabeth Quigley)
UX @ Harvard's IQSS (Elizabeth Quigley)UX @ Harvard's IQSS (Elizabeth Quigley)
UX @ Harvard's IQSS (Elizabeth Quigley)
Harvard Web Working Group
 
Tania Schlatter – Visual Usability
Tania Schlatter – Visual UsabilityTania Schlatter – Visual Usability
Tania Schlatter – Visual Usability
Harvard Web Working Group
 

Mehr von Harvard Web Working Group (20)

The Internet of Things (IoT)
The Internet of Things (IoT)The Internet of Things (IoT)
The Internet of Things (IoT)
 
Perception is Reality: Lessons Learned from User Research
Perception is Reality: Lessons Learned from User ResearchPerception is Reality: Lessons Learned from User Research
Perception is Reality: Lessons Learned from User Research
 
5 Steps to (Remote) Team Bliss: How to Build Thriving, High-Performing (Remot...
5 Steps to (Remote) Team Bliss: How to Build Thriving, High-Performing (Remot...5 Steps to (Remote) Team Bliss: How to Build Thriving, High-Performing (Remot...
5 Steps to (Remote) Team Bliss: How to Build Thriving, High-Performing (Remot...
 
Ui Testing with Ghost Inspector
Ui Testing with Ghost InspectorUi Testing with Ghost Inspector
Ui Testing with Ghost Inspector
 
Starting out with MongoDB
Starting out with MongoDBStarting out with MongoDB
Starting out with MongoDB
 
The Process of Communication, A Practical Guide for Project Managers
The Process of Communication, A Practical Guide for Project ManagersThe Process of Communication, A Practical Guide for Project Managers
The Process of Communication, A Practical Guide for Project Managers
 
Universal Design for Learning: A framework for addressing learner diversity
Universal Design for Learning: A framework for addressing learner diversityUniversal Design for Learning: A framework for addressing learner diversity
Universal Design for Learning: A framework for addressing learner diversity
 
Intro to ReactJS
Intro to ReactJSIntro to ReactJS
Intro to ReactJS
 
UX @ Harvard's IQSS (Elizabeth Quigley)
UX @ Harvard's IQSS (Elizabeth Quigley)UX @ Harvard's IQSS (Elizabeth Quigley)
UX @ Harvard's IQSS (Elizabeth Quigley)
 
Tania Schlatter – Visual Usability
Tania Schlatter – Visual UsabilityTania Schlatter – Visual Usability
Tania Schlatter – Visual Usability
 
Responsive Design: Building for a Modern Web
Responsive Design: Building for a Modern WebResponsive Design: Building for a Modern Web
Responsive Design: Building for a Modern Web
 
Demystifying UX – A toolkit approach to better, cheaper & faster experience d...
Demystifying UX – A toolkit approach to better, cheaper & faster experience d...Demystifying UX – A toolkit approach to better, cheaper & faster experience d...
Demystifying UX – A toolkit approach to better, cheaper & faster experience d...
 
Will my helicopter fit in your garage?
Will my helicopter fit in your garage?Will my helicopter fit in your garage?
Will my helicopter fit in your garage?
 
Every Screen is a Touchscreen
Every Screen is a TouchscreenEvery Screen is a Touchscreen
Every Screen is a Touchscreen
 
An Introduction to MIT's Drupal Cloud
An Introduction to MIT's Drupal CloudAn Introduction to MIT's Drupal Cloud
An Introduction to MIT's Drupal Cloud
 
Open Scholar
Open ScholarOpen Scholar
Open Scholar
 
Jumpstart Your Web App
Jumpstart Your Web AppJumpstart Your Web App
Jumpstart Your Web App
 
Draw More, Talk Less
Draw More, Talk LessDraw More, Talk Less
Draw More, Talk Less
 
Mat Marquis - JQuery Mobile
Mat Marquis - JQuery MobileMat Marquis - JQuery Mobile
Mat Marquis - JQuery Mobile
 
Curating the Open Web with Zeega
Curating the Open Web with ZeegaCurating the Open Web with Zeega
Curating the Open Web with Zeega
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
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...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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
 
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
 

Tastypie: Easy APIs to Make Your Work Easier

  • 1. Easy APIs to Make Your Work Easier Or, an opportunity to make obscure '80s references Eric Mattison Senior Web Developer FAS Informatics and Scientific Applicaitons Group
  • 2. Earthquake This presentation is going to feature lots of live demos. Something is bound to go horribly, horribly wrong. And I feel fine.
  • 3. I want my MTV (Dude, that's Sting singing backing vocals for Dire Straits!) In his talk “Your Models for Nothing and Your Admin for Free” Raman Prasad showed us the wonderful world of Django. (https://www.djangoproject.com/) Terminology Note: Django is a “Model-Template-View” framework. Which may or may not be more understandable than a “Model-View-Controller” framework. But they're essentially the same thing. I believe the creators of Django chose “Model-Template-View” purely as a paean to MTV.
  • 4. Sweet Child of Mine I'm going to be talking about creating APIs for Django using Tastypie. (http://django-tastypie.readthedocs.org)
  • 5. My Prerogative However, you should use whatever you feel comfortable with. Just make sure you're using a Model-View-Controller Framework that has a REST plugin or supports REST natively. e.g.: CakePHP: Native Symfony: FOSRestBundle Ruby on Rails: Native Spring: JAX-RS Struts: REST Plugin (and winner of the most creative plugin name)
  • 6. Put Your Hands Up (sorry, not an '80s reference) Who here has added an API to an application? Have any of you had to write an API? Fun, yeah?
  • 7. Ok, fine. Let's look at a simple example.
  • 9. Well, How did I get here? The Story of SPINAL (Scheduling & Payments for Instruments and Laboratories) BTW: Raise your hand if you've worked on a massive development project
  • 10. We Built This City The Good: - Avoids scheduling conflicts for 220+ instruments 2000+ researchers - Provides user permission management for instrument “owners” - Allows lab admins to assign expense codes to researchers for the use of instruments - Generates monthly invoices based on frankly insane billing rules
  • 11. Welcome to the Jungle The Arrgh: - SPINAL is (necessarily) complex: 111+ database tables, 100,000+ lines of code, which... - Makes upgrades difficult to QA - Takes a long time to build and deploy - Slows down the development cycle
  • 12. One Thing Leads to Another The Fixx: Much later, a facility administrator asked me to create a publicly available calendar for certain instruments. Rather than build more functionality into SPINAL, I created a new application that used data already in SPINAL. https://webapps.sciences.fas.harvard.edu/gw-schedule/ (same server, different application)
  • 13. You Dropped a Bomb on Me Installing Tastypie meant that I didn't have to write the APIs myself. And yet, I will take the credit. Well, I'll also mention Phil Durbin. He told me about Tastypie in the first place. Thanks, Phil.
  • 14. Smell the Glove SPINAL + TastyPie =
  • 15. Let's Dance Here's the output: https://webapps.sciences.fas.harvard.edu/spinal/api/v1/reservation/?format=json The Glasswash Schedule application reads the data from SPINAL and formats it for calendar display.
  • 16. What I Like About You - Don't Repeat Yourself - Less Code → Easier to understand - More contained → Easier to deploy - Fewer functions → Easier to debug - Serialization → Multi-platform support - Ajaxian → Is that even a word? - Unixian → What does this mean?
  • 17. Video Killed the Radio Star An aside on the greatness of Bruce Molay The best course I took at Harvard Extension was CSCI E-113 taught by Bruce Molay (http://www.extension.harvard.edu/about-us/faculty-directory/bruce-molay) The course was about how to chain very simple Unix tools to build a web server. Web APIs hold the promise to make web applications function the same way.
  • 18. Back on the Chain Gang Just as cal | head -n 5 | tail -n 1 | cut -d ' ' -f 5 should get you the third Thursday of the month, we should be able to “pipe” one web application into another: JSON Billing App Document App PDF
  • 20. We are Family Schools, Departments, Divisions have different needs. Enterprise applications that meet everyone's requirements are time-consuming, costly, complex and are frequently loathed by the people that have to use them. A federated approach to software development suits Harvard's organization better. Smaller programs can focus on doing one thing well. Creating sensible APIs for these programs can turn them into building blocks that anyone at Harvard (and beyond) can use.
  • 21. Gimme All Your Lovin' I Thank You
  • 22. Talk to Me The Question & Answer Part Also, beer at John Harvard's