SlideShare a Scribd company logo
#BrilliantAPIs
Developing Brilliant and
Powerful APIs in Ruby & Python
#BrilliantAPIs
Housekeeping
• Session is being recorded
• Email once presentation is posted
• Continuous Q&A
–Twitter: #BrilliantAPIs @Ready_API
–Goto Webinar chat panel
–community.smartbear.com
#BrilliantAPIs
Introductions
Shelby Switzer
Notion
Queen of API Engineering
Paul Bruce
SmartBear
API Team Product Manager
#BrilliantAPIs
What we’ll cover
• API languages, why?
• APIs in Ruby
– Rails 5
– Grape
• APIs in Python
– Django
– Flask
• Docs / M2M / Swagger
• What else is there?
– Testing: function, load,
security
– API virtualization /
sandboxing
– API ecosystem
#BrilliantAPIs
APIs in language X?
• Considerations
– What does my team already know?
– How flush is the hiring market?
– What is sustainable long-term?
– What’s easier for *everyone* to deal with?
• Why in Ruby and Python?
• Why not in something else?
#BrilliantAPIs
• Java (lots of overhead)
• .NET C# / VB / F# (proprietary stack)
• PHP (wild west)
• Node.js (because javascript)
• C++ (how old are you?)
• GO (fledgling*)
• R (too mathematical) (WTH do I mean by that?)
Why today not other languages?
* https://www.quora.com/What-reasons-are-there-to-not-use-Go-programming-language
#BrilliantAPIs
Ruby with
@switzerly
#BrilliantAPIs
Ruby terminology
• Gem => an external library
• Bundle => pack up all dependencies
• Rack => HTTP pipeline and req/resp processor
•Rails, Sinatra, Grape
• .rb => code
• Scaffolding => resource MVC generation
• Rake => make-like build utility
#BrilliantAPIs
So, Ruby & Rails: a love story
• Ruby: an awesome programming language
• Rails: a web framework for Ruby
• Ruby on Rails
– MVC pattern
– Convention over
configuration
– ActiveRecord
#BrilliantAPIs
Caching
• Key-based caching: cache_key
• ETags & conditional GETs:
stale?(last_modified: @book.updated_at.utc, etag: @book.cache_key)
#BrilliantAPIs
Testing
• Test::Unit or Rspec
• Unit tests on controllers, models, services
• Request tests for endpoints
• http://matthewlehner.net/rails-api-testing-guidelines/
#BrilliantAPIs
Hypermedia
ActiveModel::Serializer.config.adapter =
ActiveModel::Serializer::Adapter::JsonApi
See also: gem ‘roar’
#BrilliantAPIs
Documentation
• Swagger gem: https://github.com/richhollis/swagger-docs
• Easy to integrate directly in your code
• Generate docs with a rake task:
rake swagger:docs
#BrilliantAPIs
Rails 5 API: Getting Started
1. Install Rails 5:
git clone https://github.com/rails/rails.git
cd rails/
bundle install
2. Generate API:
bundle exec railties/exe/rails new ../books_app --edge --dev --api
3. Create Scaffold:
bundle exec rails generate scaffold books title description:text page_count:integer
4. Migrate the database:
bundle exec rake db:migrate
#BrilliantAPIs
API in Ruby: Example
#BrilliantAPIs
Ruby+Grape: Sweet, not Sour
• Great for small services
• Can be used with Rails, Sinatra, or alone
• Support for:
– Versioning
– Validation
– (Re)routing
– Error handling / exceptions
• Very code-focused, less data/convention
• Documentation? Boom.
http://www.sitepoint.com/build-great-apis-grape/
http://www.rubydoc.info/gems/grape/
#BrilliantAPIs
Grape: Getting Started
1. Install Grape
gem 'grape'
bundle install
2. Create an API file: api.rb
class API < Grape::API
end
3. Create a rackup file (config.ru) to run the API app
require './api'
run API
#BrilliantAPIs
Python with
@paulsbruce
#BrilliantAPIs
Similarities in Ruby & Python
Lots of “MVC-like” commonalities
models | views | logical control
Templates vs. ViewSets
Routing (routes file vs. urls file)
Database access (ActiveRecord vs. Django data model)
Access control / permissions
Rate limiting
...
#BrilliantAPIs
Python: Flask & Django
Fully featured*
but a bit more work
Limited, but
gets you there fast
* Gypsy jazz legend, Jean Baptiste "Django" Reinhardt
#BrilliantAPIs
Python: Flask
Install Python.
pip install Flask-API
Create a new directory
Create a .py file
Start typing
Easy to get started, if you know REST
Deployment: WSGI, FastCGI, …
Database access: up to you
from flask.ext.api import FlaskAPI
app = FlaskAPI(__name__)
@app.route("/example/", methods=['GET', 'POST'])
def example():
if request.method == 'GET':
return {'request data': request.data}
elif request.method == 'POST':
return '', status.HTTP_204_NO_CONTENT
raise exceptions.NotFound()
python ./yourfile.py
#BrilliantAPIs
API in Flask: Example
#BrilliantAPIs
Python: Django
Conventions for common API patterns and scaffolding.
Models Serializers
Permissions
Views
Routing Browsing
#BrilliantAPIs
Django: Getting Started
Install Python.
pip install Django
pip install DjangoRESTFramework
Find a Python-savvy editor:
• PyCharm Community
• PyScripter (Windows Only)
• PyDev (Eclipse plugin)
django-admin startproject …
cd …
python manage.py startapp …
INSTALLED_APPS = (
“rest_framework”,
“...”)
python manage.py syncdb
(write some implementation code)
python manage.py runserver
#BrilliantAPIs
API in Django: Example
#BrilliantAPIs
Django vs. Flask
Django
DjangoCon, increasing interest over time, Books and
online tutorials; great for CRUD, overload for some
Flask
Easy to get started and create, maintenance is hard.
Used by Pinterest & Linkedin
#BrilliantAPIs
Django + Swagger:
Why? Because others, that’s why.
django-rest-swagger.readthedocs.org
PyYAML (mileage may vary)
INSTALLED_APPS += ‘rest_framework_swagger’
patterns += url(r'^docs/', include('rest_framework_swagger.urls')),
...and poof!
/docs/ /docs/api-docs
#BrilliantAPIs
Lots of APIs: what’s wrong with that?
Microservices
lots of “little” distributed bits
Common problems:
Spaghetti code is imminent.
Unit testing is not enough.
Functional, integration, performance,
and security testing are even more
necessary than ever!
Hypermedia
discrete operations / behaviors
#BrilliantAPIs
API quality across language barriers
#BrilliantAPIs
Ready! API: testing & sandboxing
#BrilliantAPIs
What we’ve learned
Ruby+Rails == Awesome for big projects
Python == Great for as-needed APIs & scripting
Importance of documentation (human &
M2M)
Ready! API bridges gaps across technologies
Links to blogs and examples by email
#BrilliantAPIs
Thank You!
Shelby Switzer
@switzerly
shelbyswitzer.com
• Paul Bruce
• @paulsbruce
• paulsbruce.io

More Related Content

What's hot (20)

PPTX
Selenium and Cucumber Automation Services
LMS Solutions (India) Pvt.Ltd.
 
PPT
BDD along with Continuous Integration
Agile Testing Alliance
 
PPTX
The State of Testing 2017
SmartBear
 
PPTX
Use Automation to Assist -Not Replace- Manual Testing
SmartBear
 
PPTX
Understanding and Executing on API Developer Experience
SmartBear
 
PPTX
Mobile UI Testing using Appium and Docker
Moataz Nabil
 
PPTX
Testing in DevOps world
Moataz Nabil
 
PDF
Continuous Integration
drluckyspin
 
PPTX
Introducing OpenAPI Version 3.1
SmartBear
 
PPTX
ATAGTR2017 SPEAKING EYE for differently abled people to see the web content
Agile Testing Alliance
 
PDF
"Software Quality in the Service of Innovation in the Insurance Industry"
Applitools
 
PDF
Modern Functional Test Automation Through Visual AI - webinar w/ Raja Rao
Applitools
 
ODP
API Testing With Katalon Studio
Knoldus Inc.
 
PDF
Top 5 Features To Look for in a Codeless Automation Solution -- Presentation ...
Applitools
 
PDF
Sencha Roadshow 2017: What's New in Sencha Test
Sencha
 
PPT
Continous Integration: A Case Study
Talentica Software
 
PDF
Sencha Roadshow 2017: Sencha Upgrades - The Good. The Bad. The Ugly - Eva Luc...
Sencha
 
PDF
Learn Key Insights from The State of Web Application Testing Research Report
Sencha
 
PPTX
Appium vs Espresso and XCUI Test
Perfecto by Perforce
 
PDF
[TAQfull Meetup] Angie Jones + Expert Panel: Best Practices in Quality Manage...
Applitools
 
Selenium and Cucumber Automation Services
LMS Solutions (India) Pvt.Ltd.
 
BDD along with Continuous Integration
Agile Testing Alliance
 
The State of Testing 2017
SmartBear
 
Use Automation to Assist -Not Replace- Manual Testing
SmartBear
 
Understanding and Executing on API Developer Experience
SmartBear
 
Mobile UI Testing using Appium and Docker
Moataz Nabil
 
Testing in DevOps world
Moataz Nabil
 
Continuous Integration
drluckyspin
 
Introducing OpenAPI Version 3.1
SmartBear
 
ATAGTR2017 SPEAKING EYE for differently abled people to see the web content
Agile Testing Alliance
 
"Software Quality in the Service of Innovation in the Insurance Industry"
Applitools
 
Modern Functional Test Automation Through Visual AI - webinar w/ Raja Rao
Applitools
 
API Testing With Katalon Studio
Knoldus Inc.
 
Top 5 Features To Look for in a Codeless Automation Solution -- Presentation ...
Applitools
 
Sencha Roadshow 2017: What's New in Sencha Test
Sencha
 
Continous Integration: A Case Study
Talentica Software
 
Sencha Roadshow 2017: Sencha Upgrades - The Good. The Bad. The Ugly - Eva Luc...
Sencha
 
Learn Key Insights from The State of Web Application Testing Research Report
Sencha
 
Appium vs Espresso and XCUI Test
Perfecto by Perforce
 
[TAQfull Meetup] Angie Jones + Expert Panel: Best Practices in Quality Manage...
Applitools
 

Similar to Developing Brilliant and Powerful APIs in Ruby & Python (20)

PDF
Always up to date, testable and maintainable documentation with OpenAPI
GOG.com dev team
 
PPTX
API Conference 2021
José Haro Peralta
 
PDF
Middleware in Golang: InVision's Rye
Cale Hoopes
 
PDF
we45 DEFCON Workshop - Building AppSec Automation with Python
Abhay Bhargav
 
PPTX
2022 APIsecure_Securing APIs with Open Standards
APIsecure_ Official
 
PPTX
10 Useful Testing Tools for Open Source Projects @ TuxCon 2015
Peter Sabev
 
PPTX
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Tom Johnson
 
PPTX
Swagger - make your API accessible
Victor Trakhtenberg
 
PPTX
API workshop: Introduction to APIs (TC Camp)
Tom Johnson
 
PDF
Building RESTful APIs
Silota Inc.
 
PDF
Crafting APIs
Tatiana Al-Chueyr
 
PDF
Intro to CakePHP
Walther Lalk
 
PPTX
Building a REST API Microservice for the DevNet API Scavenger Hunt
Ashley Roach
 
PPTX
API Documentation Workshop tcworld India 2015
Tom Johnson
 
PDF
Java-Jersey 到 Python-Flask 服務不中斷重構之旅
Max Lai
 
PDF
Designing APIs with OpenAPI Spec
Adam Paxton
 
PDF
用Serverless技術快速開發line聊天機器人
Kevin Luo
 
PDF
How to Contribute to Apache Usergrid
David M. Johnson
 
PDF
Introduction to Apigility
Engineor
 
PPTX
Practices and Tools for Building Better APIs
Peter Hendriks
 
Always up to date, testable and maintainable documentation with OpenAPI
GOG.com dev team
 
API Conference 2021
José Haro Peralta
 
Middleware in Golang: InVision's Rye
Cale Hoopes
 
we45 DEFCON Workshop - Building AppSec Automation with Python
Abhay Bhargav
 
2022 APIsecure_Securing APIs with Open Standards
APIsecure_ Official
 
10 Useful Testing Tools for Open Source Projects @ TuxCon 2015
Peter Sabev
 
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Tom Johnson
 
Swagger - make your API accessible
Victor Trakhtenberg
 
API workshop: Introduction to APIs (TC Camp)
Tom Johnson
 
Building RESTful APIs
Silota Inc.
 
Crafting APIs
Tatiana Al-Chueyr
 
Intro to CakePHP
Walther Lalk
 
Building a REST API Microservice for the DevNet API Scavenger Hunt
Ashley Roach
 
API Documentation Workshop tcworld India 2015
Tom Johnson
 
Java-Jersey 到 Python-Flask 服務不中斷重構之旅
Max Lai
 
Designing APIs with OpenAPI Spec
Adam Paxton
 
用Serverless技術快速開發line聊天機器人
Kevin Luo
 
How to Contribute to Apache Usergrid
David M. Johnson
 
Introduction to Apigility
Engineor
 
Practices and Tools for Building Better APIs
Peter Hendriks
 
Ad

More from SmartBear (20)

PPTX
Enforcing Your Organization's API Design Standards with SwaggerHub
SmartBear
 
PPTX
IATA Open Air: How API Standardization Enables Innovation in the Airline Indu...
SmartBear
 
PPTX
The State of API 2020 Webinar – Exploring Trends, Tools & Takeaways to Drive ...
SmartBear
 
PPTX
How LISI Automotive Accelerated Application Delivery with SwaggerHub
SmartBear
 
PPTX
Standardising APIs: Powering the Platform Economy in Financial Services
SmartBear
 
PPTX
Getting Started with API Standardization in SwaggerHub
SmartBear
 
PPTX
Adopting a Design-First Approach to API Development with SwaggerHub
SmartBear
 
PPTX
Standardizing APIs Across Your Organization with Swagger and OAS | A SmartBea...
SmartBear
 
PPTX
Effective API Lifecycle Management
SmartBear
 
PDF
The API Lifecycle Series: Exploring Design-First and Code-First Approaches to...
SmartBear
 
PDF
The API Lifecycle Series: Evolving API Development and Testing from Open Sour...
SmartBear
 
PPTX
Artificial intelligence for faster and smarter software testing - Galway Mee...
SmartBear
 
PDF
Successfully Implementing BDD in an Agile World
SmartBear
 
PPTX
The Best Kept Secrets of Code Review | SmartBear Webinar
SmartBear
 
PPTX
How Capital One Scaled API Design to Deliver New Products Faster
SmartBear
 
PPTX
Testing Without a GUI Using TestComplete
SmartBear
 
PPTX
Hidden Treasure - TestComplete Script Extensions
SmartBear
 
PDF
How Bdd Can Save Agile
SmartBear
 
PPTX
API Automation and TDD to Implement Master Data Survivorship Rules
SmartBear
 
PDF
Support Rapid Systems Growth with a Design-First Approach
SmartBear
 
Enforcing Your Organization's API Design Standards with SwaggerHub
SmartBear
 
IATA Open Air: How API Standardization Enables Innovation in the Airline Indu...
SmartBear
 
The State of API 2020 Webinar – Exploring Trends, Tools & Takeaways to Drive ...
SmartBear
 
How LISI Automotive Accelerated Application Delivery with SwaggerHub
SmartBear
 
Standardising APIs: Powering the Platform Economy in Financial Services
SmartBear
 
Getting Started with API Standardization in SwaggerHub
SmartBear
 
Adopting a Design-First Approach to API Development with SwaggerHub
SmartBear
 
Standardizing APIs Across Your Organization with Swagger and OAS | A SmartBea...
SmartBear
 
Effective API Lifecycle Management
SmartBear
 
The API Lifecycle Series: Exploring Design-First and Code-First Approaches to...
SmartBear
 
The API Lifecycle Series: Evolving API Development and Testing from Open Sour...
SmartBear
 
Artificial intelligence for faster and smarter software testing - Galway Mee...
SmartBear
 
Successfully Implementing BDD in an Agile World
SmartBear
 
The Best Kept Secrets of Code Review | SmartBear Webinar
SmartBear
 
How Capital One Scaled API Design to Deliver New Products Faster
SmartBear
 
Testing Without a GUI Using TestComplete
SmartBear
 
Hidden Treasure - TestComplete Script Extensions
SmartBear
 
How Bdd Can Save Agile
SmartBear
 
API Automation and TDD to Implement Master Data Survivorship Rules
SmartBear
 
Support Rapid Systems Growth with a Design-First Approach
SmartBear
 
Ad

Recently uploaded (20)

PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PPTX
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
July Patch Tuesday
Ivanti
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 

Developing Brilliant and Powerful APIs in Ruby & Python

  • 2. #BrilliantAPIs Housekeeping • Session is being recorded • Email once presentation is posted • Continuous Q&A –Twitter: #BrilliantAPIs @Ready_API –Goto Webinar chat panel –community.smartbear.com
  • 3. #BrilliantAPIs Introductions Shelby Switzer Notion Queen of API Engineering Paul Bruce SmartBear API Team Product Manager
  • 4. #BrilliantAPIs What we’ll cover • API languages, why? • APIs in Ruby – Rails 5 – Grape • APIs in Python – Django – Flask • Docs / M2M / Swagger • What else is there? – Testing: function, load, security – API virtualization / sandboxing – API ecosystem
  • 5. #BrilliantAPIs APIs in language X? • Considerations – What does my team already know? – How flush is the hiring market? – What is sustainable long-term? – What’s easier for *everyone* to deal with? • Why in Ruby and Python? • Why not in something else?
  • 6. #BrilliantAPIs • Java (lots of overhead) • .NET C# / VB / F# (proprietary stack) • PHP (wild west) • Node.js (because javascript) • C++ (how old are you?) • GO (fledgling*) • R (too mathematical) (WTH do I mean by that?) Why today not other languages? * https://www.quora.com/What-reasons-are-there-to-not-use-Go-programming-language
  • 8. #BrilliantAPIs Ruby terminology • Gem => an external library • Bundle => pack up all dependencies • Rack => HTTP pipeline and req/resp processor •Rails, Sinatra, Grape • .rb => code • Scaffolding => resource MVC generation • Rake => make-like build utility
  • 9. #BrilliantAPIs So, Ruby & Rails: a love story • Ruby: an awesome programming language • Rails: a web framework for Ruby • Ruby on Rails – MVC pattern – Convention over configuration – ActiveRecord
  • 10. #BrilliantAPIs Caching • Key-based caching: cache_key • ETags & conditional GETs: stale?(last_modified: @book.updated_at.utc, etag: @book.cache_key)
  • 11. #BrilliantAPIs Testing • Test::Unit or Rspec • Unit tests on controllers, models, services • Request tests for endpoints • http://matthewlehner.net/rails-api-testing-guidelines/
  • 13. #BrilliantAPIs Documentation • Swagger gem: https://github.com/richhollis/swagger-docs • Easy to integrate directly in your code • Generate docs with a rake task: rake swagger:docs
  • 14. #BrilliantAPIs Rails 5 API: Getting Started 1. Install Rails 5: git clone https://github.com/rails/rails.git cd rails/ bundle install 2. Generate API: bundle exec railties/exe/rails new ../books_app --edge --dev --api 3. Create Scaffold: bundle exec rails generate scaffold books title description:text page_count:integer 4. Migrate the database: bundle exec rake db:migrate
  • 16. #BrilliantAPIs Ruby+Grape: Sweet, not Sour • Great for small services • Can be used with Rails, Sinatra, or alone • Support for: – Versioning – Validation – (Re)routing – Error handling / exceptions • Very code-focused, less data/convention • Documentation? Boom. http://www.sitepoint.com/build-great-apis-grape/ http://www.rubydoc.info/gems/grape/
  • 17. #BrilliantAPIs Grape: Getting Started 1. Install Grape gem 'grape' bundle install 2. Create an API file: api.rb class API < Grape::API end 3. Create a rackup file (config.ru) to run the API app require './api' run API
  • 19. #BrilliantAPIs Similarities in Ruby & Python Lots of “MVC-like” commonalities models | views | logical control Templates vs. ViewSets Routing (routes file vs. urls file) Database access (ActiveRecord vs. Django data model) Access control / permissions Rate limiting ...
  • 20. #BrilliantAPIs Python: Flask & Django Fully featured* but a bit more work Limited, but gets you there fast * Gypsy jazz legend, Jean Baptiste "Django" Reinhardt
  • 21. #BrilliantAPIs Python: Flask Install Python. pip install Flask-API Create a new directory Create a .py file Start typing Easy to get started, if you know REST Deployment: WSGI, FastCGI, … Database access: up to you from flask.ext.api import FlaskAPI app = FlaskAPI(__name__) @app.route("/example/", methods=['GET', 'POST']) def example(): if request.method == 'GET': return {'request data': request.data} elif request.method == 'POST': return '', status.HTTP_204_NO_CONTENT raise exceptions.NotFound() python ./yourfile.py
  • 23. #BrilliantAPIs Python: Django Conventions for common API patterns and scaffolding. Models Serializers Permissions Views Routing Browsing
  • 24. #BrilliantAPIs Django: Getting Started Install Python. pip install Django pip install DjangoRESTFramework Find a Python-savvy editor: • PyCharm Community • PyScripter (Windows Only) • PyDev (Eclipse plugin) django-admin startproject … cd … python manage.py startapp … INSTALLED_APPS = ( “rest_framework”, “...”) python manage.py syncdb (write some implementation code) python manage.py runserver
  • 26. #BrilliantAPIs Django vs. Flask Django DjangoCon, increasing interest over time, Books and online tutorials; great for CRUD, overload for some Flask Easy to get started and create, maintenance is hard. Used by Pinterest & Linkedin
  • 27. #BrilliantAPIs Django + Swagger: Why? Because others, that’s why. django-rest-swagger.readthedocs.org PyYAML (mileage may vary) INSTALLED_APPS += ‘rest_framework_swagger’ patterns += url(r'^docs/', include('rest_framework_swagger.urls')), ...and poof! /docs/ /docs/api-docs
  • 28. #BrilliantAPIs Lots of APIs: what’s wrong with that? Microservices lots of “little” distributed bits Common problems: Spaghetti code is imminent. Unit testing is not enough. Functional, integration, performance, and security testing are even more necessary than ever! Hypermedia discrete operations / behaviors
  • 31. #BrilliantAPIs What we’ve learned Ruby+Rails == Awesome for big projects Python == Great for as-needed APIs & scripting Importance of documentation (human & M2M) Ready! API bridges gaps across technologies Links to blogs and examples by email