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

.

//msdn.microsoft.com/en-us/library/7314433t(v=vs.90).aspx

//Classes incluí­das // Project ... Add References

using System.Net;

using System.Net.Http;

using Newtonsoft.Json.Linq;

private void ServiceNow()               {

                      this.rtbOutput.Text = " Iniciando...";

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

                      request.Method = "Get";

                      request.KeepAlive = true;

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

                      request.UseDefaultCredentials = true;

                      request.Credentials = new NetworkCredential(txtUser.Text, txtPassword.Text, "");

                      request.ContentType = "application/json";

                      //request.ContentType = "application/x-www-form-urlencoded";

                      string myResponse = "";

                      try

                      {

                              //get cookie from Web API

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

                              //get content

                              using (System.IO.StreamReader reader = new System.IO.StreamReader(response.GetResponseStream()))

                              {

                                      myResponse = reader.ReadToEnd();

                              }

                      }

                      catch(InvalidCastException e)

                      {

                              //Log Error

                              this.rtbOutput.AppendText("ERRO: " + e.Source);

                      }

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

 

                      JObject rss = JObject.Parse(myResponse);

                      this.rtbOutput.AppendText(myResponse);

                      //"Project" -> "Manage NuGet packages" -> "Search for "newtonsoft json". -> click "install".

                      Newtonsoft.Json.Linq.JToken objToken;

                      objToken = rss.SelectToken("result");

                      string made_sla = (string)rss["result"][0]["made_sla"];

                      string short_description = (string)rss["result"][0]["short_description"];

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

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

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

                      this.rtbOutput.AppendText("short_description==> " + short_description);

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

                      this.rtbOutput.AppendText("made_sla==> " + made_sla);

              }

GitHub - ServiceNow: Webservice REST Service Now

A .Net client for ServiceNow's REST TableAPI in C#

Web Services C Sharp .NET End to End Tutorial - ServiceNow Wiki

Microsoft .NET Web Services Client Examples - ServiceNow Wiki

REST tool for ServiceNow APIs - YouTube

C# .NET Client consuming a ServiceNow SOAP Web Service - YouTube

How to read data from ServiceNow REST API using SSIS  

Web Services Integrations Best Practices - ServiceNow Wiki

ServiceNow Integration Technology Stack — ServiceNow Developer Blog

Outros documentos em português