Wednesday 2:50 p.m.–3:20 p.m.

Building a REST API with Django & Django REST Framework

Kenny Yarboro

Audience level:

Novice

Description

REST APIs are capable of providing valuable services within and beyond an organization. Django and the Django REST Framework enabled my team to quickly deliverable a highly functional REST API that was customized to our unique needs. This discussion will cover how easy Django makes it to build such an application and how to overcome potential pitfalls.

Abstract

Introduction

  1. Quick Introduction of the Django REST Framework

  2. Basic Building Blocks

    1. Models
    2. Serializers
    3. Views
    4. URLs
    5. Settings
  3. Enabling Additional Data Formats

    1. JSON
    2. XML

Considerations Before Building a Custom API

  1. 'Disabling' Certain API Views

    1. Who can access which views?
    2. How do you 'disable' a view?
  2. Adding Custom Validators & Handling Validation Errors

    1. When to use an existing validator?
    2. When to create a custom validator?
    3. What to do when data is invalid?
  3. Manipulating Data Flowing within the Application

    1. What data does the application need that is NOT part of the model?
    2. What data needs to be returned to the user that is NOT part of the model?
  4. Enabling a Single API Call to Accept Multiple Input Formats

    1. When would this be necessary?
    2. How can backwards-compatibility be maintained when re-designing an API view?
  5. Customizing the Save Process Behind an API POST

    1. Why would this need to be done?
    2. How can a single API POST save data across multiple models and database tables?
      1. Considerations for Saving Each Database Entry
      2. Considerations for Using Bulk Insert
  6. Documentation Considerations

    1. Built-in Browsable API
    2. Swagger
    3. Serializer Considerations
  7. Closing Remarks