HTTP Responses - JSON Response Format

HTTP Responses / JSON Response Format

Each request made to the Optidash API yields a structured JSON response that includes a success boolean indicator, the corresponding HTTP status code, and a unique request id.

Responses to Successful Requests

Upon a successful API invocation, the response will not only signify success but also provide detailed metadata pertaining to both the input and output images. Specifically, the output section will include a url pointing to the processed image. This image can be accessed either through our temporary storage solution or an external storage option of your choosing. For guidance on how to download processed images, please refer to the relevant section within our API Introduction.

Within the JSON response, you will discover the sha1 hashes for both the input and output images. These hashes serve as unique identifiers, enabling you to efficiently track the processing status of your images through the 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 instances where a request results in an error, the success property within the JSON response will be marked as false, accompanied by a detailed error message to aid in diagnosing the issue. Should you require assistance with a specific request, including the request id when contacting us will facilitate the quickest 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"
}