[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/SangeCoder/fullstackpython.com/gh-pages/api-creation.html [Back]  [Original]

API Creation - Full Stack Python Fork me on GitHub [Fork me on GitHub]

API Creation

Creating and exposing APIs allows your web application to interact with other applications through machine-to-machine communication.

API creation frameworks

  • Django REST framework and Tastypie are the two most widely used API frameworks to use with Django. The edge currently goes to Django REST framework based on rough community sentiment. Django REST framework continues to knock out great releases after the 3.0 release mark when Tom Christie ran a successful Kickstarter campaign.

  • Flask-RESTful and Flask API are popular libraries for exposing APIs from Flask web applications.

  • Sandman is a widely used tool to automatically generate a RESTful API service from a legacy database without writing a line of code (though it's easily extensible through code).

  • Cornice is a REST framework for Pyramid.

  • Restless is a lightweight API framework that aims to be framework agnostic. The general concept is that you can use the same API code for Django, Flask, Bottle, Pyramid or any other WSGI framework with minimal porting effort.

  • Eve is a Python REST framework built with Flask, MongoDB and Redis. The framework's primary author Nicola Iarocci gave a great talk at EuroPython 2014 that introduced the main features of the framework.

API testing projects

Building, running and maintaining APIs requires as much effort as building, running and maintaining a web application. API testing frameworks are the equivalent of browser testing in the web application world.

  • zato-apitest invokes HTTP APIs and provides hooks for running through other testing frameworks.

Hosted API testing services

  • Runscope is an API testing SaaS application that can test both your own APIs and external APIs that your application relies upon.

  • API Science is focused on deep API testing, including multi-step API calls and monitoring of external APIs.

  • SmartBear has several API monitoring and testing tools for APIs.

API creation resources

Python-specific API creation resources

  • Choosing an API framework for Django by PyDanny contains questions and insight into what makes a good API framework and which one you should currently choose for Django.

  • Create a REST API in Minutes with Pyramid and Ramses is a thorough tutorial from start to finish that uses the Pyramid web framework along with Ramses, a library that uses YAML files to generate a RESTful API.

  • RESTful web services with Python is an interesting overview of the Python API frameworks space.

  • Implementing a RESTful Web API with Python & Flask is a good walkthrough for coding a Flask app that provides standard web API functionality such as proper HTTP responses, authentication and logging.

  • REST Hooks is an open source Python project that makes it easier to implement subscription-based "REST hooks". These REST hooks are similar to webhooks, but provide a different mechanism for subscribing to updates via a REST interface. Both REST hooks and webhooks are far more efficient than polling for updates and notifications.

API creation learning checklist

  1. Pick an API framework appropriate for your web framework. For Django I recommend Django REST framework and for Flask I recommend Flask-RESTful.

  2. Begin by building out a simple use case for the API. Generally the use case will either involve data that users want in a machine-readable format or a backend for alternative clients such as an iOS or Android mobile app.

  3. Add an authentication mechanism through OAuth or a token scheme.

  4. Add rate limiting to the API if data usage volume could be a performance issue. Also add basic metrics so you can determine how often the API is being accessed and whether it is performing properly.

  5. Provide ample documentation and a walkthrough for how the API can be accessed and used.

  6. Figure out other use cases and expand based on what you learned with the initial API use case.

What's next after building an API for your project?

What are web application programming interfaces (APIs)?

How do I integrate existing web APIs into my application?

Show me a list of the best Python learning resources.

email address:
b_b7e774f0c4f05dcebbfee183d_b22335388d:


Web Proxy Viewer  |  New URL  |  Original Page