Media files
GET /media/:game/:file returns a picture that belongs to a public game. You normally do not build this address yourself: you get it ready-made as thumbnail_url, or in a game’s gallery.
Getting the address
Section titled “Getting the address”curl -s "https://bazoodle.com/api/v1/catalog/browse?limit=1"In the response, a card’s thumbnail_url looks like this (shortened):
https://bazoodle.com/api/v1/media/GAME/FILE.pngUse the whole address as given. File names contain a fingerprint of the content, so never guess one and never change one. When a game has no picture yet, thumbnail_url is null: show your own placeholder.
Request
Section titled “Request”curl -s -o thumbnail.png "THUMBNAIL_URL_FROM_THE_RESPONSE"There are no parameters. Send Range to fetch part of a large file, such as a large screenshot:
curl -s -H "Range: bytes=0-1023" -o part.bin "GALLERY_URL_FROM_THE_RESPONSE"Response headers
Section titled “Response headers”| Header | Value |
|---|---|
Content-Type |
The file’s real type, such as image/png |
Cache-Control |
public, max-age=31536000, immutable: the file never changes |
ETag |
A fingerprint of the file, for conditional requests |
Accept-Ranges |
bytes |
X-Content-Type-Options |
nosniff |
Cross-Origin-Resource-Policy |
cross-origin: you may show the file in an <img> or <video> on any website |
Errors
Section titled “Errors”| Status | Cause |
|---|---|
404 |
There is no such file, or it is not public: pictures are only served after moderation approves them |
416 |
The Range you asked for is outside the file |
429 |
You are over the media rate limit |
- A game’s new picture can take a little time to appear, because it is shown after moderation approves it. A replaced picture gets a new address.
- Keep what you download: files never change at their address, so cache them as long as you use them (Show a game page has the code).
- The pictures belong to their creators. Show them next to a link to the game rather than reusing them elsewhere; see Fair use.