Modify conversion options

If a job is not yet started, you may need to patch it to modify the conversion's options. You can reach the goal by sending a conversion PATCH request to the endpoint:

/v2/jobs/<job_id>/conversions/<conversion_id>

with the new options inside the body like in the following example.

Let's assume that your job with id f496edcb-64e2-4f76-abf0-74f75338d4eb has a conversion with id 1886af23-86ac-461e-9a86-87d018260043 that looks like the following:

"conversion": [{
    "id": "1886af23-86ac-461e-9a86-87d018260043",
    "target": "gif",
    "category": "image",
    "options": {
        "download_password": null,
        "allow_multiple_outputs": false,
        "dpi": 300,
        "width": 500,
        "height": 300,
        "crop_top": null,
        "crop_bottom": null,
        "crop_left": null,
        "crop_right": null,
        "crop_origin_x": null,
        "crop_origin_y": null,
        "crop_width": null,
        "crop_height": null,
        "color": "1980",
        "enhance": null,
        "normalize": null,
        "sharpen": null,
        "antialias": null,
        "despeckle": null,
        "equalize": null,
        "deskew": null,
        "rotate": null,
        "preset": null,
        "alpha_channel": null
    },
    "metadata": {},
    "output_target": []
}]

Now, let's assume you want to modify the options by removing dpi, updating the image's size (width x height) and setting deskew.

Your PATCH request should look like the following:

PATCH /v2/jobs/f496edcb-64e2-4f76-abf0-74f75338d4eb/conversions/1886af23-86ac-461e-9a86-87d018260043 HTTP/1.1
Host: api.api2convert.com
x-oc-api-key: <your API key here>
Content-Type: application/json
Cache-Control: no-cache

{
    "options": {
        "dpi": null,
        "width": 1024,
        "height": 768,
        "deskew": true
    }
}

Note that all of the other options will keep the old values, like e.g. "color": "1980".

If you send a GET /v2/jobs/f496edcb-64e2-4f76-abf0-74f75338d4eb request, the conversion object in the response will reflect your PATCH like the following:

"conversion": [{
    "id": "1886af23-86ac-461e-9a86-87d018260043",
    "target": "gif",
    "category": "image",
    "options": {
        "download_password": null,
        "allow_multiple_outputs": false,
        "dpi": null,
        "width": 1024,
        "height": 768,
        "crop_top": null,
        "crop_bottom": null,
        "crop_left": null,
        "crop_right": null,
        "crop_origin_x": null,
        "crop_origin_y": null,
        "crop_width": null,
        "crop_height": null,
        "color": "1980",
        "enhance": null,
        "normalize": null,
        "sharpen": null,
        "antialias": null,
        "despeckle": null,
        "equalize": null,
        "deskew": true,
        "rotate": null,
        "preset": null,
        "alpha_channel": null
    },
    "metadata": {},
    "output_target": []
}]

Please, note that you can PATCH only the options and metadata objects of the conversions.

results matching ""

    No results matching ""