Send a job uploading a file

In order to create a simple conversion of a file located on your computer or server you will need to:

  • Send a job without any input files
  • Retrieve the server and id keys from the response
  • Concatenate the server value with /upload-file/ and the id value

The resulting string should look like this:

https://www13.online-convert.com/dl/web2/upload-file/39ef70ea-efc8-42a2-84dc-2090e1055077

POST /jobs HTTP/1.1
Host: api2.online-convert.com
x-oc-api-key: <your API key here>
Content-Type: application/json
Cache-Control: no-cache

{
    "conversion": [{
        "category": "image",
        "target": "png"
    }]
}
curl -X POST \
  https://api2.online-convert.com/jobs \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'x-oc-api-key: <your API key here>' \
  -d '{
    "conversion": [{
        "category": "image",
        "target": "png"
    }]
}'

After generating the URL you will have to do a POST request to it.

The field file is where you put the contents of the file you want to send.

The optional text field decrypt_password is where you put the password to open a password protected file.

Once the file is uploaded, the job will continue its lifecycle, start processing the conversion and eventually finish.

Please note that, even if not mandatory, it's highly recommended to set a unique random string for each file that you upload. This can prevent conversion problems in some corner cases. You don't need to send a full UUID, a short random string should be enough.

POST /dl/web2/upload-file/39ef70ea-efc8-42a2-84dc-2090e1055077 HTTP/1.1
Host: www13.online-convert.com
x-oc-api-key: <your API key goes here>
Cache-Control: no-cache
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="myfile.png"
Content-Type: image/png

... contents of the file go here ...
------WebKitFormBoundary7MA4YWxkTrZu0gW--
curl -X POST \
  https://www13.online-convert.com/dl/web2/upload-file/39ef70ea-efc8-42a2-84dc-2090e1055077 \
  -H 'cache-control: no-cache' \
  -H 'x-oc-api-key: <your API key here>' \
  -F file=@/path/to/image.png

results matching ""

    No results matching ""