Cloud Storage
Amazon S3
To allow our servers to save files on an Amazon S3 storage, follow these instructions:
- This is a list of permissions required:
s3:GetObject
- Used to download a file
- Can be ignored if you will not use Amazon S3 files as an input
s3:PutObject
- Used to store a file
s3:PutObjectAcl
- Used to grant different Access Control List (ACL) values when storing a file
Below you can find a list with the fields that are accepted in this output target:
Field | Description | Required | Default |
---|---|---|---|
output_target.type | Specifies the type of the output target, in this case amazons3. | Yes | N/A |
output_target.parameters.bucket | Determines to which bucket our servers upload the file. | Yes | N/A |
output_target.parameters.region | Indicates the region configured for your bucket. A list of Amazon S3 region names can be found here. If you don't specify this field and your bucket is configured to use another region than the default, any download will fail. | No | eu-central-1 |
output_target.parameters.file | Amazon S3 key of the object that will be stored. Usually looks like
a normal file path, e.g. pictures/mountains.jpg .
|
Yes | N/A |
output_target.credentials.accesskeyid | The Amazon S3 access key ID. | Yes | N/A |
output_target.credentials.secretaccesskey | The Amazon S3 secret access key. | Yes | N/A |
output_target.credentials.sessiontoken | Together with secretaccesskey and
accesskeyid , this is used to authenticate using
temporary credentials. For more information on how to generate
temporary credentials please check how to install AWS CLI tool and how to
do a call to AWS STS get-session-token.
|
No | N/A |
Once the needed permission to store files into an Amazon S3 bucket have been set up, the request can be issued.
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": "amazons3",
"parameters": {
"bucket": "oc-bucket",
"file": "test.png"
},
"credentials": {
"accesskeyid": "your access key id",
"secretaccesskey": "your secret access key"
}
}]
}]
}
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": "amazons3",
"parameters": {
"bucket": "oc-bucket",
"file": "test.png"
},
"credentials": {
"accesskeyid": "your access key id",
"secretaccesskey": "your secret access key"
}
}]
}]
}'