Let's add a
Job
class to our project:
public class Job { private readonly string dataFilePath; public Job(string dataFilePath) { this.dataFilePath = dataFilePath; } }
The dataFilePath
argument is the path to the data.xml
file we created earlier.
Creating the job is as easy as calling a REST URL:
public void Create() { var uri = String.Format("{0}?input=xml&output=xml&key={1}", Settings.DataflowUri, Settings.Key); var data = File.ReadAllBytes(dataFilePath); try { var wc = new WebClient(); wc.Headers.Add("Content-Type", "application/xml"); var receivedBytes = wc.UploadData(uri, "POST", data); ParseJobResponse(receivedBytes); } catch (WebException e) { var response = (HttpWebResponse)e.Response; var status = response.StatusCode; } }
We place all the...