For the Bible API, I made the decision early on that I was going to be using JSON for the API.
Creating a JSON API in Django is extremely simple.
First, we make sure to import serializers from
In the verses method, we get the verses from the model. Next, we check if the
HTTP_ACCEPT header contains
application/json. If so, then we return an HttpResponsewith the verses serialized to “json” with a
You can then test your API using curl.
And that’s it. You can also do the same with XML if you so choose.
Questions? E-mail me: this domain AT gmail DOT com