public async Task<string> SubmitJob(string jobName, string[] filePaths) { JobSubmission jobSubmission = new JobSubmission { Name = jobName, Type = "FfmpegSample", RequiredFiles = filePaths.Select(f => new RequiredFile { Name = Path.GetFileName(f), Timestamp = File.GetLastWriteTimeUtc(f) }).ToList(), JobFile = Path.GetFileName(filePaths[0]), // not actually used in this case, but the API requires a job file }; var response = await _httpClient.PostAsJsonAsync("/api/jobs", jobSubmission); EnsureSucceeded(response); var result = await response.Content.ReadAsAsync<SubmittedJob>(); return result.Link.Href; }
public string SubmitJob(string jobName, string[] filePaths) { JobSubmission jobSubmission = new JobSubmission { Name = jobName, Type = "FfmpegSample", RequiredFiles = filePaths.Select(f => new RequiredFile { Name = Path.GetFileName(f), Timestamp = File.GetLastWriteTimeUtc(f) }).ToList(), JobFile = Path.GetFileName(filePaths[0]), // not actually used in this case, but the API requires a job file }; var request = new RestRequest(_baseAddress + "/api/jobs", Method.POST); request.RequestFormat = DataFormat.Json; request.AddBody(jobSubmission); IRestResponse<SubmittedJob> response = _restClient.Execute<SubmittedJob>(request); EnsureSucceeded(response); return response.Data.Link.Href; }