diff --git a/ConfigurationUpdater/Nomad.cs b/ConfigurationUpdater/Nomad.cs index beaf8506bcf4a3c23105a9330d25f73d8b76f8cf..2f912eac9eb9295030362980cc8b27818388f66e 100644 --- a/ConfigurationUpdater/Nomad.cs +++ b/ConfigurationUpdater/Nomad.cs @@ -14,15 +14,25 @@ namespace ConfigurationUpdater public static string UpdateJob(string jobId) { + string jobUrl = "http://localhost:4646/v1/job/" + jobId; - string postUrl = "http://localhost:4646/v1/job/" + jobId; - var httpWebRequest = (HttpWebRequest)WebRequest.Create(postUrl); + var request = (HttpWebRequest)WebRequest.Create(jobUrl); + + var response = (HttpWebResponse)request.GetResponse(); + + var jobString = ""; + using (var streamReader = new StreamReader(response.GetResponseStream())) + { + jobString = streamReader.ReadToEnd(); + } + + var httpWebRequest = (HttpWebRequest)WebRequest.Create(jobUrl); httpWebRequest.ContentType = "application/json"; httpWebRequest.Method = "POST"; using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) { - string json = "{\"Job\": {}}"; + string json = "{\"Job\":" + jobString + "}"; streamWriter.Write(json); streamWriter.Flush();