API Documentation

Defining the API version is STRONGLY recommended as not defining one will always result in the newest API being used!
You can append ?format=json to this URL to receive a machine parsable version of this documentation!

V2 API

Base URL: https://random-d.uk/api or https://random-d.uk/api/v2

Endpoints

GET /random

Returns a JSON object containing a link to the random image and an optional attribution message

Supported Query Params

Type: GIF or JPG

Response Object

content-type: application/json

{"url": "https://random-d.uk/api/images/51.jpg", "message": "Powered by random-d.uk"}


GET /quack

Same behaviour as /random



GET /randomimg

Returns an image file

Supported Query Params

Type: GIF or JPG

Response Object

content-type: image/jpeg or image/gif

File



GET /list

Returns a JSON object containing all filenames we have available
Note: Arrays are not returned in order

Response Object

content-type: application/json
                {"images": ["1.jpg", "2.jpg"], "gifs": ["1.gif', '2.gif"], "http": ['400.jpg', ['404.jpg'], "image_count": 119, "gif_count" 38}


GET /:num.jpg

Returns an image file directly

Response Object

content-type: image/jpeg

File



GET /:num.gif

Returns a gif file directly

Response Object

content-type: image/gif

File



GET /http/:code

Returns an image file of a duck representing an HTTP status code directly
Defining the extension .jpg is not required

Response Object

content-type: image/jpeg

File



Uploading Images

POST https://random-d.uk/add

Upload images to our queue

Use Query String ?format=json if you are integrating image upload into your application, or you will not receive your upload status

Encoding: multipart/form-data



V1 (Legacy) API

Usage of the V1 endpoints is strongly discouraged and the V1 API may be discontinued at any time.
These endpoints are backwards compatible implementations of the behaviour of the old API.

Base URL: https://random-d.uk/api/v1

Endpoints

GET /random

This endpoint was unaltered in V2



GET /quack

This endpoint was unaltered in V2



GET /randomimg

Redirects the user to an image URL

Response

302 Redirect. Example URL: https://random-d.uk/api/images/61.jpg



GET /randomgif

Redirects the user to a GIF URL

Response

302 Redirect. Example URL: https://random-d.uk/api/gifs/12.gif



GET /images/:num.jpg

This endpoint was deprecated, use /:num.jpg instead!



GET /gifs/:num.gif

This endpoint was deprecated, use /:num.gif instead!



GET /http/:code.jpg

This endpoint was unaltered in V2