Practice Lab

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

MethodAddressWhat it doesStatus codes
GET/api/v1/books.xmlThe same books as XML200 OK
GET/api/v1/booksSend the header Accept: application/xml and /books answers with XML200 OK
GET/api/v1/filesThe downloadable files with size and SHA-256 checksum200 OK
GET/api/v1/files/{name}Download sample.txt, numbers.csv or logo.png200 OK, 404 Not found
POST/api/v1/filesUpload a file (multipart/form-data, a part named file, at most 1 MB). It is described and forgotten201 Created, 400 Bad request, 413 Body too big, 415 Unsupported media type