Announcing the Global SNUG Board of Directors. Learn more here

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
tiagomacul
Mega Sage
Mega Sage

.

private void ServiceNowUpdate()

              {

                   

                      string myResponse = "";

                      this.rtbOutput.Text = " Iniciando Update ... \r\n";

                      this.rtbOutput.AppendText("URL: " + txtURL.Text + "\r\n");

                      System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(txtURL.Text);

                      request.Method = "PUT";

                      request.KeepAlive = true;

                      request.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;

                      request.UseDefaultCredentials = true;

                      request.Credentials = new System.Net.NetworkCredential("user", "password", "");

                      request.ContentType = "application/json";

                      request.Accept = "application/json";

                      string postData = "{ '" + txtField.Text   + "':'" + txtValue.Text   + "'}";

                      byte[] byteArray = Encoding.UTF8.GetBytes(postData);

                      // Set the ContentLength property of the WebRequest.

                      request.ContentLength = byteArray.Length;

                      // Get the request stream.

                      System.IO.Stream dataStream = request.GetRequestStream();

                      // Write the data to the request stream.

                      dataStream.Write(byteArray, 0, byteArray.Length);

                      // Close the Stream object.

                      dataStream.Close();

                      System.Net.HttpWebResponse response;

                   

                      response = (System.Net.HttpWebResponse)request.GetResponse();

                      this.rtbOutput.AppendText("\r\n");

                      this.rtbOutput.AppendText("\r\n");

                      //Newtonsoft.Json.Linq.JObject rss = Newtonsoft.Json.Linq.JObject.Parse(myResponse);

                      this.rtbOutput.AppendText(myResponse);

              }

Know-More-Now-Logo.jpg

SOAP web service

Web Service Service Now Consultando um incidente utilizando C#

Consume a ServiceNow Scripted Web Service from a .Net Client

Outros documentos em português