Cloud Storage
Google Cloud Storage
To allow our servers to save files on a Google Cloud Storage, follow these instructions:
- Generate a json private key file following these instructions. Its contents will be needed later.
- Create a project following these instructions.
- Create a bucket which contains the files that you want to download following these instructions.
Below you can find a list with the fields accepted in this output target:
Field | Description | Required | Default |
---|---|---|---|
output_target.type | Specifies the type of output target, in this case googlecloud. | Yes | N/A |
output_target.parameters.projectid | The ID of your Google Cloud project. | Yes | N/A |
output_target.parameters.bucket | Determines to which bucket our servers upload the file. | Yes | N/A |
output_target.parameters.file | Complete path to where the file will be uploaded, e.g. folder-inside-bucket/image.jpeg .
|
Yes | N/A |
output_target.credentials.keyfile | Here, specify the contents of your json private key file. You can generate one following these instructions. | Yes | N/A |
Please note that in some circumstances (e.g. already existing filename on the cloud) the upload can be refused. For these reasons, it's highly recommended to upload converted files in new directories.
POST /v2/jobs HTTP/1.1
Host: api.api2convert.com
x-oc-api-key: <your API key here>
Content-Type: application/json
Cache-Control: no-cache
{
"input": [{
"type": "remote",
"source": "https://example-files.online-convert.com/raster%20image/jpg/example_small.jpg"
}],
"conversion": [{
"category": "image",
"target": "png",
"output_target": [{
"type": "googlecloud",
"parameters": {
"projectid": "your project id",
"bucket": "your bucket name",
"file": "the complete path to where you want to store the file"
},
"credentials": {
"keyfile": {
"type": "...",
"project_id": "...",
"private_key_id": "...",
"private_key": "...",
... and more fields below ...
}
}
}]
}]
}
curl -X POST \
https://api.api2convert.com/v2/jobs \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-H 'x-oc-api-key: <your API key here>' \
-d '{
"input": [{
"type": "remote",
"source": "https://example-files.online-convert.com/raster%20image/jpg/example_small.jpg"
}],
"conversion": [{
"category": "image",
"target": "png",
"output_target": [{
"type": "googlecloud",
"parameters": {
"projectid": "your project id",
"bucket": "your bucket name",
"file": "the complete path to where you want to store the file"
},
"credentials": {
"keyfile": {
"type": "...",
"project_id": "...",
"private_key_id": "...",
"private_key": "...",
... and more fields below ...
}
}
}]
}]
}'