Images

Image entity
NAMETYPEDESCRIPTION

id

int

Unique ID for the image.

author_id

int

ID of the user who created the image.

user_id

int

ID of the user who owns the image.

namespace_id

int

nullable

ID of the namespace the image belongs to if any.

name

string

The name of the image.

created_at

timestamp

The RFC3339 formatted string at which the image was created.

url

string

The API URL for the image entity itself.

author

object

nullable

The user who authored the image.

user

object

nullable

The user the image belongs to.

namespace

object

nullable

The namespace the image belongs to, if any.

ENTITIES
ENDPOINTS

List images

List the images for the currently authenticated user. The following parameters can be given as query parameters to the URL. This requires the image:read permission.

Parameters
NAMETYPEDESCRIPTION

search

string

Get the images with names like the given value.

Returns

This will return a list of images. The list will be paginated to 25 images per page, and will be ordered lexically. If the images were paginated, then the pagination information will be in the response header Link.

Link: <https://api.djinn-ci.com/images?page=1>; rel="prev",
      <https://api.djinn-ci.com/images?page=3>; rel="next"

GET /images
$ curl -X GET \
	-H "Authorization: Bearer 1a2b3c4d5f" \
	https://api.djinn-ci.com/images

Create image

This will create an image for the currently authenticated user. This requires the image:write permission.

Images can be created in two ways, either via a direct upload, or via a download. If the image is being created via an upload, then the contents of the image should be sent in the request body, and the parameters set as URL query parameters. If the image is being created via a download, then a regular JSON payload can be sent, specifying the download URL.

Parameters
NAMETYPEREQUIREDDESCRIPTION

name

string

Yes

The name of the image to create.

namespace

string

No

The namespace to upload the image to.

download_url

string

No*

The URL to download the image from. Only required if the image is being downloaded.

Returns

Returns the created image. It returns an error if any of the parameters are invalid, or if an internal error occurs.

POST /images
$ curl -X POST \
	-H "Authorization: Bearer 1a2b3c4d5f" \
	-d "@alpine.qcow2" \
	https://api.djinn-ci.com/images?name=alpine


$ curl -X POST \
	-H "Authorization: Bearer 1a2b3c4d5f" \
	-d "@alpine.qcow2" \
	https://api.djinn-ci.com/images?name=alpine&namespace=djinn

$ curl -X POST \
	-H "Authorization: Bearar 1a2b3c4d5f" \
	-H "Content-Type: application/json" \
	-d '{"name": "alpine", "namespace": "djinn", "download_url": "https://example.com/alpine"}'
	https://api.djinn-ci.com/images

Get image

This will get the image by the given :id. This requires the image:read permission.

If the Accept header is set to application/x-qemu-disk, then the response body will be the contents of the image file.

Returns

This will return the image.

GET /images/:id
$ curl -X GET \
	-H "Authorization: Bearer 1a2b3c4d5f" \
	https://api.djinn-ci.com/images/3

$ curl -X GET \
	-H "Accept: application/x-qemu-disk" \
	-H "Authorization: Bearer 1a2b3c4d5f" \
	https://api.djinn-ci.com/images/3

Delete image

This will delete the image by the given :id. This requires the image:delete permission.

Returns

This returns no content in the response body.

DELETE /images/:id
$ curl -X DELETE \
	-H "Authorization: Bearer 1a2b3c4d5f" \
	https://api.djinn-ci.com/images/3