<divstyle="padding: 0 0 20px 0; margin: 0 0 20px 0; background-color: #22B24C;">
<divclass="container">
<h2style="color: #fff; margin: 20px 40px 0 0;"><ahref="https://www.gumroad.com/l/python-deployments" style="color: #fff">The Full Stack Python Guide to Deployments book</a> has been released!</h2>
</div>
</div><ahref="https://github.com/makaimc/fullstackpython.com"><imgstyle="position: absolute; top: 0; right: 0; border: 0;" src="/theme/img/fork.png" alt="Fork me on GitHub"></a>
is an appeal that metadata makes a difference in whether APIs are descriptive
or not.</p>
</li>
<li>
<p><ahref="http://artsy.github.io/blog/2014/09/12/designing-the-public-artsy-api/">Designing the Artsy API</a>
has their recommendations list for building an API based on their recent
experiences.</p>
</li>
<li>
<p><ahref="https://bourgeois.me/rest/">Some REST Best Practices</a> is a high level
summary of rules to follow while creating your API.</p>
</li>
<li>
<p>Hacker News had a discussion on
<ahref="https://news.ycombinator.com/item?id=8912897">what's the best way to write an API spec?</a>
that provides a few different viewpoints on this topic.</p>
</li>
<li>
<p><ahref="https://pages.apigee.com/rs/apigee/images/api-design-ebook-2012-03.pdf">Apigee's Web API Design ebook</a>
is free and contains a wealth of practical advice for what design
decisions to make for your web API.</p>
</li>
<li>
<p><ahref="http://developers.lyst.com/2015/02/20/1-to-1-relationships-and-subresources-in-rest-apis/">1-to-1 Relationships and Subresources in REST APIs</a>
tells the story of design decisions that were made during an API's creation
and why those choices were made.</p>
</li>
<li>
<p><ahref="https://blogs.dropbox.com/developers/2015/04/how-many-http-status-codes-should-your-api-use/">How many status codes does your API need?</a>
gives an answer from a Dropbox API developer as to their decision making
is based on Heroku's best practices for the platform's API.</p>
</li>
</ul>
<h2>Python-specific API creation resources</h2>
<ul>
<li>
<p><ahref="http://pydanny.com/choosing-an-api-framework-for-django.html">Choosing an API framework for Django</a>
by <ahref="https://twitter.com/pydanny">PyDanny</a> contains questions and insight
into what makes a good API framework and which one you should currently
choose for Django.</p>
</li>
<li>
<p><ahref="https://realpython.com/blog/python/create-a-rest-api-in-minutes-with-pyramid-and-ramses/">Create a REST API in Minutes with Pyramid and Ramses</a>
is a thorough tutorial from start to finish that uses the
<ahref="/pyramid.html">Pyramid</a> web framework along with
<ahref="https://pypi.python.org/pypi/ramses/">Ramses</a>, a library that uses
YAML files to generate a RESTful API.</p>
</li>
<li>
<p><ahref="http://www.slideshare.net/Solution4Future/python-restful-webservices-with-python-flask-and-django-solutions">RESTful web services with Python</a>
is an interesting overview of the Python API frameworks space.</p>
</li>
<li>
<p><ahref="http://blog.luisrei.com/articles/flaskrest.html">Implementing a RESTful Web API with Python & Flask</a>
is a good walkthrough for coding a Flask app that provides standard
web API functionality such as proper HTTP responses, authentication
and logging.</p>
</li>
<li>
<p><ahref="http://resthooks.org/">REST Hooks</a> 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.</p>
</li>
<li>
<p>Serialization is common for transforming objects into web API JSON
results. One company found the serialization performance of Django REST
framework was lacking so they created
<ahref="https://github.com/clarkduvall/serpy">Serpy</a> and
<ahref="https://engineering.betterworks.com/2015/09/04/ditching-django-rest-framework-serializers-for-serpy/">wrote a blog post with the results of its performance</a>.</p>
</li>
<li>
<p>To create an API to export your data in comma-separated values,
check out this
<ahref="http://codingpole.com/using-django-rest-framework-for-csv-export/">blog post on exporting data as CSV format with Django REST framework</a>.</p>
</li>
</ul>
<h2>API creation learning checklist</h2>
<ol>
<li>
<p>Pick an API framework appropriate for your web framework. For Django I
recommend Django REST framework and for Flask I recommend Flask-RESTful.</p>
</li>
<li>
<p>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.</p>
</li>
<li>
<p>Add an authentication mechanism through OAuth or a token scheme.</p>
</li>
<li>
<p>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.</p>
</li>
<li>
<p>Provide ample documentation and a walkthrough for how the API can be
accessed and used.</p>
</li>
<li>
<p>Figure out other use cases and expand based on what you learned with the
initial API use case.</p>
</li>
</ol>
<h3>What's next after building an API for your project?</h3>
<ahref="http://www.deploypython.com/"><imgsrc="https://static.fullstackpython.com/fsp-deployment-guide.png" alt="The Full Stack Python Guide to Deployments" width="100%"></a>
<pstyle="font-size: .8em; margin-top: 10px;">Searching for a complete, step-by-step deployment walkthrough? Learn more about <ahref="http://www.deploypython.com/">The Full Stack Python Guide to Deployments book</a>.
</p>
</div>
</div><divclass="panel panel-success">
<divclass="panel-heading">
<h3class="panel-head"><ahref="/table-of-contents.html" style="color: #fff;">Table of Contents</a></h3>
<ahref="/about-author.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>About the Author</a>
</div>
</div>
<divclass="panel panel-success">
<divclass="panel-body">
<ahref="http://www.deploypython.com/"><imgsrc="https://static.fullstackpython.com/fsp-deployment-guide.png" alt="The Full Stack Python Guide to Deployments" width="100%"></a>
<pstyle="font-size: .8em; margin-top: 10px;">Searching for a complete, step-by-step deployment walkthrough? Learn more about <ahref="http://www.deploypython.com/">The Full Stack Python Guide to Deployments book</a>.