Media Processing Server Documentation

General Information

The media server is available at retoucher.hz.labs.retouch4.me.

All API requests are made to /api/v1/<route>, for example:

https://retoucher.hz.labs.retouch4.me/api/v1/retoucher/getFile/s0me-very-l0ng-1d

The general retouching pipeline is as follows:

  1. The image processing task is submitted via /retoucher/start
  1. While processing is pending, you can request the current status at /retoucher/status/{id}
  1. If the process completes successfully, the result can be fetched from /retoucher/getFile/{id}

Register Task /retoucher/start

Request Description

Protocol HTTP
Method POST
contentType multipart/form-data

The following fields are expected in the request body:

Processing

  1. The task is registered on the server and receives a unique ID
  1. User token is verified
  1. The task is queued for processing and returns the task ID

Successful Response

If the request is successful, the task is queued, and the server returns

a JSON object with the following fields:

Possible Errors

If the request is missing a file, the server returns a 400 error with message="No file uploaded"

If there are issues on the server, it returns a 500 error with an error message.

If the CRM returns a 4xx error, a 4xx error code and message="Token issue" are returned.

If the server cannot communicate with the CRM or returns a 200 status, processing continues.


Retouch Status Request /retoucher/status/{id}

Protocol HTTP
Method GET

Request Description

GET request, id is passed in the URL.

Example request:

https://retoucher.hz.labs.retouch4.me/api/v1/retoucher/status/s0me-very-l0ng-1d

Successful Response

In case of a successful request, the server returns JSON with the following fields:

Possible Errors

If no task with the given id is found, the server returns a 404 error

If there is a server error, a 500 error is returned

Notes

It's better not to request status updates too frequently, such as using a 1-second interval


Get Retouch Result /retoucher/getFile/{id}

Request Description

GET request, id is passed as a param in the URL (similar to the status request).

Successful Response

Depending on the task, this endpoint returns:

This documentation covers tasks with mode=professional, so the response is expected to be a ZIP archive.

Possible Errors

If no task with the given id is found, the server returns a 404 error

If there is a server error, a 500 error is returned

Notes

The /retoucher/getFile request should be made only after receiving a status with state="completed". Even if progress=100, the result may not yet be saved in a file, and the server won’t be able to return it.

It’s also not possible to request old files, as the results are stored for only 24 hours.

Limitations

Before submitting a retouch request, you should check the file (photo or archive) for limitations. The list of limitations can be obtained with a GET request to /info/limits

This endpoint returns JSON in the following format:

{

image: {

formats: ["png", "jpg", "jpeg"],

maxFileSizeInMB: 100,

maxMegapixels: 250

},

archive: {

formats: ["zip"]

}

}

The JSON above indicates that the allowed image formats are png, jpg, jpeg, the maximum file size is 100 MB, and the image resolution should not exceed 250 megapixels.

If these limitations are violated, the task may not be processed.

At the moment, this endpoint is not available in production.