I'm working on Salesforce and wanting to get cases fields in it. found the command
curl https://yoursite.desk.com/api/v2/cases \
-u email:password \
-H 'Accept: application/json'
And I tried it in command prompt as
curl https://xxx.desk.com/api/v2/cases \-u [email protected]:xxxxxxxxx \ -H 'Accept: application/json'
I have tried the below code in C#
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create("https://xxxx.desk.com/api/v2/cases");
httpWebRequest.ContentType = "application/json";
httpWebRequest.Accept = "text/xml";
httpWebRequest.Method = "GET";
httpWebRequest.Credentials = new NetworkCredential("username", "password");
var response = httpWebRequest.GetResponse();
But it is returning an error
The remote server returned an error: (401) Unauthorized.