POST https://sync.api.cloudconvert.com/v2/jobs
{
"tasks": {
"import-my-file": {
"operation": "import/url",
"url": "https://my.url/file.jpg"
},
"compress-my-file": {
"operation": "optimize",
"input": "import-my-file",
"input_format": "jpg",
"quality": 75
},
"export-my-file": {
"operation": "export/url",
"input": "compress-my-file"
}
},
"redirect": true
}
<?php
$job = (new Job())
->addTask(
(new Task('import/url', 'import-my-file'))
->set('url', 'https://my.url/file.jpg')
)
->addTask(
(new Task('optimize', 'compress-my-file'))
->set('input', 'import-my-file')
->set('input_format', 'jpg')
->set('quality', 75)
)
->addTask(
(new Task('export/url', 'export-my-file'))
->set('input', 'compress-my-file')
);
$cloudconvert->jobs()->create($job);
let exampleJob = await cloudConvert.jobs.create({
"tasks": {
"import-my-file": {
"operation": "import/url",
"url": "https://my.url/file.jpg"
},
"compress-my-file": {
"operation": "optimize",
"input": "import-my-file",
"input_format": "jpg",
"quality": 75
},
"export-my-file": {
"operation": "export/url",
"input": "compress-my-file"
}
}
});
job = await cloudConvert.jobs.wait(job.id);
job = cloudconvert.jobs.create({
tasks: [
{
name: "import-my-file",
operation: "import/url",
url: "https://my-url/file.jpg"
},
{
name: "compress-my-file",
operation: "optimize",
input: "import-my-file",
input_format: "jpg",
quality: 75
},
{
name: "export-my-file",
operation: "export/url",
input: "compress-my-file"
},
]
})
job = cloudconvert.Job.create(payload={
"tasks": {
'import-my-file': {
'operation': 'import/url',
'url': 'https://my.url/file.jpg'
},
'compress-my-file': {
'operation': 'convert',
'input': 'import-my-file',
'input_format': 'jpg',
'quality': 75
},
'export-my-file': {
'operation': 'export/url',
'input': 'compress-my-file'
}
}
})
final JobResponse createJobResponse = cloudConvertClient.jobs().create(
ImmutableMap.of(
"import-my-file",
new UrlImportRequest()
.setUrl("https://my.url/file.jpg"),
"compress-my-file",
new OptimizeFilesTaskRequest()
.setInput("import-my-file")
.setInputFormat("jpg"),
.set("quality", 75),
"export-my-file",
new UrlExportRequest()
.setInput("compress-my-file")
)
).getBody();
var job = await CloudConvert.CreateJobAsync(new JobCreateRequest
{
Tasks = new
{
import_it = new ImportUrlCreateRequest
{
Url = "https://my.url/file.jpg"
},
compress = new OptimizeCreateRequest
{
Input = "import_it",
Input_Format = "jpg",
Quality = 75
},
export_it = new ExportUrlCreateRequest
{
Input = "compress"
}
}
});
Use our Job Builder to generate ready-to-use requests and code snippet for the
CloudConvert API.
Job Builder
API Documentation