【发布时间】:2015-08-06 13:42:06
【问题描述】:
我正在使用 Salesforce 并希望在其中获取案例字段。找到命令
curl https://yoursite.desk.com/api/v2/cases \
-u email:password \
-H 'Accept: application/json'
我在命令提示符下试了一下
curl https://xxx.desk.com/api/v2/cases \-u abc@gmail.com:xxxxxxxxx \ -H 'Accept: application/json'
我已经在 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();
但它返回一个错误
The remote server returned an error: (401) Unauthorized.
【问题讨论】:
标签: c# json salesforce