HTTP Responses - JSON Response Format

HTTP Responses / JSON Response Format

Every request to Optidash API will result in a deferred JSON response containing a boolean success property, HTTP status code and associated request id.

Responses to Successful Requests

Upon a successful call, the API will also return metadata for both the input and output (resulting) images. The output hash will always contain a url of the processed image available in our temporary storage or your External Storage of choice. Please read the section in the API Introduction about downloading processed images.

Within the response JSON you'll also find sha1 hash of both input and output images which might help you to track which images have been already processed with Optidash API.

Example response for a successful API call:

HTTP/1.1 200 OK

{
    "success": true,
    "code": 200,
    "id": "9fccf4b5-cfab-4e92-9276-5d2028fcb6a0",
    "input": {
        "name": "image.jpg",
        "format": "JPEG",
        "width": 400,
        "height": 300,
        "colorspace": "YCbCr",
        "interlaced": false,
        "sampling": "4:2:2",
        "depth": 24,
        "quality": 95,
        "bytes": 85285,
        "sha1": "b752df4c53d29212e71eecc08b9cf6c4ab6f0652"
    },
    "output": {
        "url": "https://s3.optidash.ai/temp/13b2a651-a459-4357-8746-8558a429e1a3/image.jpg",
        "name": "image.jpg",
        "format": "JPEG",
        "width": 1600,
        "height": 1200,
        "colorspace": "YCbCr",
        "interlaced": true,
        "sampling": "4:2:0",
        "depth": 24,
        "quality": 91,
        "bytes": 310881,
        "sha1": "b91f615ed5e10aa95f94a3e9ab7483f664d7b173"
    }
}

Responses to Failed Requests

In the case of an erroneous call, the success property will be set to false and a descriptive error message will also be provided. If you need to contact us about a specific request, providing the request id will ensure the fastest possible resolution.

HTTP/1.1 422 UNPROCESSABLE ENTITY

{
    "success": false,
    "code": 422,
    "id": "c9521e2b-1df6-46b9-9da7-e2de29d96853",
    "message": "Adjust 'contrast' parameter must be an integer within -100 to 100 range"
}