RightNow CRM XML API-有人熟悉吗?
时间:2020-03-06 14:47:22 来源:igfitidea点击:
我需要在vb.net或者c中创建一个用户控件,以搜索RightNow CRM数据库。我有关于他们的XML API的文档,但是我不确定如何发布到他们的解析器,然后捕获返回数据并将其显示在页面上。
任何示例代码将不胜感激!
链接到API:http://community.rightnow.com/customer/documentation/integration/82_crm_integration.pdf
解决方案
我不知道RightNow CRM,但是根据文档,我们可以使用HTTP发布来发送XML请求。在.NET中执行此操作的最简单方法是使用WebClient类。另外,我们可能想看一下HttpWebRequest / HttpWebResponse类。这是一些使用WebClient的示例代码:
using System.Net;
using System.Text;
using System;
namespace RightNowSample
{
class Program
{
static void Main(string[] args)
{
string serviceUrl = "http://<your_domain>/cgi-bin/<your_interface>.cfg/php/xml_api/parse.php";
WebClient webClient = new WebClient();
string requestXml =
@"<connector>
<function name=""ans_get"">
<parameter name=""args"" type=""pair"">
<pair name=""id"" type=""integer"">33</pair>
<pair name=""sub_tbl"" type='pair'>
<pair name=""tbl_id"" type=""integer"">164</pair>
</pair>
</parameter>
</function>
</connector>";
string secString = "";
string postData = string.Format("xml_doc={0}, sec_string={1}", requestXml, secString);
byte[] postDataBytes = Encoding.UTF8.GetBytes(postData);
byte[] responseDataBytes = webClient.UploadData(serviceUrl, "POST", postDataBytes);
string responseData = Encoding.UTF8.GetString(responseDataBytes);
Console.WriteLine(responseData);
}
}
}
我无权使用RightNow CRM,因此无法进行测试,但是它可以为我们提供帮助。

