Cloud Geek Open Platform Interface invocation method (C #)

Source: Internet
Author: User

Cloud Geek provides SaaS-based, intelligent question and answer services for businesses. Support the rapid introduction of enterprise personalized Knowledge Base, with the help of semantic model understanding and analysis, so that enterprise customers immediately have the industry's 24-hour customer service small experts. Its SaaS model realizes the visualization of real-time customer service data with zero-cost input, optimizes enterprise business process and directs enterprise decision-making.

Plainly, in fact, is a smart customer service robot, you can chat with him, but also can and his nonsense, but it is important that you can use him as a customer service, teach him things, liberate himself. OK, here's the ad, look at the interface-related stuff.

Please click here for the interface documentation of the Cloud Geek.

The following uses C #. NET describes the call methods of two interfaces, the platform interface is set to post and get method requests, so here for each request method selected an interface as a case, if there is no clear can leave a message or contact me through the help documentation.

1,post

In the Help document, the post interface required to introduce the parameters of the egg pain (plug-ins do not support writing on it, so ...) ), I put in the "Resource Description" place, I hope you understand.

When invoking the Post interface, it is important to note that I write almost all of the data in JSON format, so you need to be careful when you are spelling strings.

Here I introduce the test classification of the interface, this interface is the interface that everyone can use, it is very important. The code is as follows:

Try            {                //cloud-Agnostic interface Documentation:Http://robot.yunjizhike.com/zhike/help                //test the Classification interface:http://robot.yunjizhike.com/zhike/Help/Api/POST-Category-TestCategory                //Test Category Interface Links                Const stringForm_url ="http://robot.yunjizhike.com/Zhike/Category/TestCategory"; //parameters required for interface: {groupId: "", Message: "", Parentcate: "", takecount:1}                Const stringgroup_id ="553da1c1d0204328d4a7****"; Const stringMESSAGE ="Hello"; Const stringParent_cate =""; Const intTake_count =3; varKeyValue =string. Format (@"{{groupId: "" {0} "", Message: "" {1} "", Parentcate: "" {2} "", Takecount:{3}}}", group_id, MESSAGE, Parent_cate, Take_count); varPostData =Encoding.UTF8.GetBytes (KeyValue); //set the relevant parameters for the submission                varRequest = WebRequest.Create (Form_url) asHttpWebRequest; Request. Method="POST"; Request. KeepAlive=false; Request. AllowAutoRedirect=true; Request. ContentType="Application/json"; Request. ContentLength=postdata.length; //Submit Request Data                varOutputStream =request.                GetRequestStream (); Outputstream.write (PostData,0, postdata.length);                Outputstream.close (); //Get test Results                varResponse = Request. GetResponse () asHttpWebResponse; varResponsestream =Response.                GetResponseStream (); varReader =NewStreamReader (Responsestream, Encoding.GetEncoding ("UTF-8")); var result=Reader.                ReadToEnd (); Reader.                Close ();            Console.WriteLine (result); }            Catch(Exception ex) {Console.WriteLine (ex).            Message); }

2,get

Get interface calls are relatively simple, just need to stitch the required parameters into the URL.

My example here is to get the interface of categorical reply, which can also be used in general. The code is as follows:

Try            {                //cloud-Agnostic interface Documentation:Http://robot.yunjizhike.com/zhike/help                //test the Classification interface:Http://robot.yunjizhike.com/zhike/Help/Api/GET-Reply-GetRandomReply_categoryId_tag                //Test Category Interface Links                Const stringGet_url ="http://robot.yunjizhike.com/Zhike/Reply/GetRandomReply"; //interface Required Parameters: CATEGORYID, tag (default null)                Const stringcategory_id ="553da1ecd0204328d4a7****"; Const stringTAG =""; varURL =string. Format ("{0}?categoryid={1}&tag={2}", Get_url, category_id, TAG); varClient =NewWebClient (); varDatas =client.                Downloaddata (URL); var result=Encoding.UTF8.GetString (datas);            Console.WriteLine (result); }            Catch(Exception ex) {Console.WriteLine (ex). Message);            }

Summarize:

In fact, the interface call is very simple, just a few commonly used get post, if you encounter any problems, you can contact me.

Wish, use pleasant.

Cloud Geek Open Platform Interface invocation method (C #)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.