API Lab · class day 47
XML, file upload and download
The same books as XML, a file upload that is checked and forgotten, and downloads with a checksum to compare.
Send X-Sandbox: your-name with every request to get your own data. Addresses start with /api/v1 after this site's address.
Addresses for today
| Method | Address | What it does | Status codes |
|---|---|---|---|
| GET | /api/v1/books.xml | The same books as XML | 200 OK |
| GET | /api/v1/books | Send the header Accept: application/xml and /books answers with XML | 200 OK |
| GET | /api/v1/files | The downloadable files with size and SHA-256 checksum | 200 OK |
| GET | /api/v1/files/{name} | Download sample.txt, numbers.csv or logo.png | 200 OK, 404 Not found |
| POST | /api/v1/files | Upload a file (multipart/form-data, a part named file, at most 1 MB). It is described and forgotten | 201 Created, 400 Bad request, 413 Body too big, 415 Unsupported media type |