Skip to Content
Building RESTful Python Web Services
book

Building RESTful Python Web Services

by Gastón C. Hillar
October 2016
Intermediate to advanced
418 pages
9h 52m
English
Packt Publishing
Content preview from Building RESTful Python Web Services

Creating and retrieving related resources

Now, we will use the HTTPie command or its curl equivalents to compose and send HTTP requests to the API. We will use JSON for the requests that require additional data. Remember that you can perform the same tasks with your favorite GUI-based tool or with the browsable API.

First, we will compose and send an HTTP request to create a new game category. Remember that we used the browsable API to create a game category named '3D RPG'.

http POST :8000/game-categories/ name='2D mobile arcade'

The following is the equivalent curl command:

curl -iX POST -H "Content-Type: application/json" -d '{"name":"2D mobile arcade"}' :8000/game-categories/

The preceding command will compose and send a POST HTTP request with ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On RESTful Python Web Services - Second Edition

Hands-On RESTful Python Web Services - Second Edition

Gastón C. Hillar

Publisher Resources

ISBN: 9781786462251Supplemental Content