Base64

To send a base64 input, the following is required:

  • Send a job without any input files
  • The response should contain the keys id and server
    {
      "id": "abcdd66e-bfb6-4ef3-b443-787131bb84b3",
      ...
      ...
      "server": "https://wwwXX.online-convert.com/dl/webX"
      ...
      ...
    }
    
  • Retrieve the server and id keys from the response
  • Concatenate the server value with /upload-base64/ and the id value

The resulting string looks like this:

https://wwwXX.online-convert.com/dl/webX/upload-base64/abcdd66e-bfb6-4ef3-b443-787131bb84b3

This is just an example. Make sure to use the values you get in the response of the create job call.

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": [{
        "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": [{
        "target": "png"
    }]
}'

After generating the URL, do a POST request to it.

The form has to contain the following fields:

  • content: The base64 encoded data
  • filename: This parameter is optional. If not specified, the file will be named "output".

Once the base64 data is sent, the job will continue its lifecycle, start processing the conversion and eventually finish.

POST /dl/web2/upload-base64/a6f691e2-839e-49e5-829d-dc2d97486fe1 HTTP/1.1
Host: www13.online-convert.com
x-oc-api-key: <your API key here>
Content-Type: application/json
Cache-Control: no-cache

{
  "content": "data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=",
  "filename": "black-pixel"
}
curl -X POST \
  https://www13.online-convert.com/dl/web2/upload-base64/a6f691e2-839e-49e5-829d-dc2d97486fe1 \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'x-oc-api-key: <your API key here>' \
  -d '{
  "content": "data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=",
  "filename": "black-pixel"
}'

If you want to send more than one base64-encoded file at once, you can send them inside an array as shown in the following example:

POST /dl/web2/upload-base64/a6f691e2-839e-49e5-829d-dc2d97486fe1 HTTP/1.1
Host: www13.online-convert.com
x-oc-api-key: <your API key here>
Content-Type: application/json
Cache-Control: no-cache

[{
  "content": "data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=",
  "filename": "black_pixel.gif"
},{
  "content": "data:text/plain;base64,dGVzdCBzdHJpbmc=",
  "filename": "example_string.txt"
}]
curl -X POST \
  https://www13.online-convert.com/dl/web2/upload-base64/a6f691e2-839e-49e5-829d-dc2d97486fe1 \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'x-oc-api-key: <your API key here>' \
  -d '[{
        "content": "data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=",
        "filename": "black_pixel.gif"
      },{
        "content": "data:text/plain;base64,dGVzdCBzdHJpbmc=",
        "filename": "example_string.txt"
      }]'

Please note that the max size of the JSON body should not exceed 1 GB.

results matching ""

    No results matching ""