To add to what Pete has stated above, you can loop through each URL and create an 'ImportUrlCreateRequest' task for each one, see
CloudConvert API[
^]
With the below code I am using a list called 'importTasks' to store all the 'ImportUrlCreateRequest tasks' dynamically, then loop through each URL in your list and create an 'ImportUrlCreateRequest' task for each URL. I then use this list to add all 'ImportUrlCreateRequest' tasks dynamically in the Tasks object when creating the job -
List<object> importTasks = new List<object>();
List<string> pdfUrls = new List<string>
{
"https://mypdf1/pdf",
"https://mypdf2/pdf",
};
foreach (string url in pdfUrls)
{
importTasks.Add(new ImportUrlCreateRequest
{
Url = url
});
}
var job = await _cloudConvert.CreateJobAsync(new JobCreateRequest
{
Tasks = new
{
import_tasks = importTasks.ToArray(),
ImportUrlCreateRequest tasks dynamically
merge_my_files = new MergeCreateRequest
{
Input = "import_tasks",
Output_Format = CloudConvert.API.Models.Enums.MergeOutputFormat.pdf
},
export_it = new ExportUrlCreateRequest
{
Input = "merge_my_files"
}
}
});