API

You may also want to read our tutorial to get a quick explanation of how to use this api.

All calls are prefixed by https://www.printmosaic.com/api/v2

POST /mosaics

Creates a mosaic.

Required params:

token the token to authenticate yourself. Log in to view your token here.
path should be the path to an online image, starting with http://

Optional params:

resolution the number of tiles the mosaic will be made of. Default is [100, 100].
tile_size the size of each small tile (in mm). Default is 10.
border_size The size of the border around the image. This number is multiplied by the tile size, so a border_size of 2 and a tile_size of 10 will give a border of 20mm all around the image. Default is 2.

Example with curl:

curl  --request POST \
 -d 'token=YOUR-TOKEN' \
 -d 'path=https%3A%2F%2Fs3.amazonaws.com%2Fmozaiku-test2%2Fsmiling_dog_small.jpg' \
 https://www.printmosaic.com/api/v2/mosaics

Example response:

The response should confirm that the path you gave can be read.
{"mosaic_id":":mosaic_id","mosaic_url":"https://www.printmosaic.com/mosaics/:mosaic_id"}

PATCH :id/update

This call allows you to add any small images to a mosaic. This could prove useful if you need to add images from sources not yet supported by PrintMosaic.

Required params:

token the token to authenticate yourself. Log in to view your token here.
id the mosaic id
images should be an array of http:// prefixed paths

Example with curl:

(Image paths are only 'a' and 'b' for readability)
curl  --request PATCH \
 -d 'token=YOUR-TOKEN' \
 -d 'images%5B%5D=a&images%5B%5D=b' \
 https://www.printmosaic.com/api/v2/mosaics/:mosaic_id

Example response:

The response should confirm that the paths you gave are correctly parsed.
{"images":["a","b"]}

DELETE :id

deletes a mosaic

Required params:

token the token to authenticate yourself. Log in to view your token here.
id the mosaic id

Example with curl:

curl  \
 -X DELETE \
 https://www.printmosaic.com/api/v2/mosaics/:mosaic_id

POST :id/generate_preview

Once you have added small images to your mosaic, you can start the preview generation.

Required params:

token the token to authenticate yourself. Log in to view your token here.
id the mosaic id

Example with curl:

curl  --request POST \
 -d 'token=YOUR-TOKEN' \
 https://www.printmosaic.com/api/v2/mosaics/:mosaic_id/generate_preview

Example response:

The response should confirm that the generation has started.
{"success":"The preview generation is starting now"}

POST :id/generate_hires

If you like the preview of a mosaic, you can now generate the high resolution. This is useful when using a pro account. Note that this call requires that you have prepaid a quota. view your quota

Required params:

token the token to authenticate yourself. Log in to view your token here.
id the mosaic id

Example with curl:

curl  --request POST \
 -d 'token=YOUR-TOKEN' \
 https://www.printmosaic.com/api/v2/mosaics/:mosaic_id/generate_hires

Example response:

The response should confirm that the generation has started.
{"success":"The high resolution image generation is starting now"}

GET :id/progress_preview

Once you have started the preview generation, it can be useful to query its progress.

Required params:

token the token to authenticate yourself. Log in to view your token here.
id the mosaic id

Example with curl:

curl  \
 https://www.printmosaic.com/api/v2/mosaics/:mosaic_id/progress_preview?token=YOUR-TOKEN

Example response:

The response should confirm that the generation has started.
{"progress_preview":75}

GET :id/progress_hires

Once you have started the hires generation, it can be useful to query its progress.

Required params:

token the token to authenticate yourself. Log in to view your token here.
id the mosaic id

Example with curl:

curl  \
 https://www.printmosaic.com/api/v2/mosaics/:mosaic_id/progress_hires?token=YOUR-TOKEN

Example response:

The response should confirm that the generation has started.
{"progress_hires":92}