Forex API interface is simple to do
Http://open.yixin.im/document/oauth/api
Follow the steps in the guide to take advantage of the test ID provided by the easy-faith
AppID (client_id): yxbbd0e8b3dce64e02bab42437becc4384 appsecret:5a1db5830047b4a
Access_token can be easily obtained, as well as specifying the toaccountid of the contact person
Next, submit a test request to the Forex Web Service using the Apache HTTP component mentioned in the previous blog post
PackageCom.newflypig.demo;Importjava.util.ArrayList;Importjava.util.List;ImportOrg.apache.http.HttpResponse;ImportOrg.apache.http.NameValuePair;Importorg.apache.http.client.HttpClient;Importorg.apache.http.client.entity.UrlEncodedFormEntity;ImportOrg.apache.http.client.methods.HttpPost;Importorg.apache.http.impl.client.HttpClients;ImportOrg.apache.http.message.BasicNameValuePair;Importorg.apache.http.util.EntityUtils;/*** Example of sending post requests to the e-mail server *@authorNewflydd * The relevant data of the letter of trust is as follows: * URL:https://open.yixin.im/api/sendp2pmsg* access_token:b2421624-db5c-44d1-93f0-1e71f9cxxxxx * TOACCOUNTID:6C0F7514F4BDXXXX (唐蔚) ; Fd60e46db0dc119cfea740c3375xxxxx (Wang Qun) * Content: Data that needs to be pushed * {"text_content": "This text is sent from the easy-Letter SDK sample program, and sent by the server automatic call", "desc": " No description required, "type": "Text"} * {"image": "http://img.hoop8.com/attachments/1510/911826782594.jpg" ," title ":" New Development Points "," url ":"http://img.hoop8.com/attachments/1510/911826782594.jpg"," type ":" Image "} **/ Public classSendposttoyixin { Public Static voidMain (string[] args)throwsexception{HttpClient Client=Httpclients.createdefault (); HttpPost Post=NewHttpPost ("Https://open.yixin.im/api/sendp2pmsg"); List<NameValuePair> parameters=NewArraylist<namevaluepair>(); Parameters.Add (NewBasicnamevaluepair ("Access_token", "b2421624-db5c-44d1-93f0-1e71f9cxxxxx")); Parameters.Add (NewBasicnamevaluepair ("Toaccountid", "fd60e46db0dc119cfea740c337xxxxx")); Parameters.Add (NewBasicnamevaluepair ("content", "{\" text_content\ ": \" This text is sent from the easy-Letter SDK sample program, and sent by the server automatically called \ ", \" desc\ ": \" does not need to describe \ ", \" Type\ " : \ "Text\"} ")); Post.setentity (NewUrlencodedformentity (Parameters, "UTF-8")); HttpResponse Response=Client.execute (POST); System.out.println (Entityutils.tostring (Response.getentity ())); }}
It's simple, I don't want to explain more.
By the way, bloggers Access_token and Toaccountid the last three letters have been modified, otherwise we can use these two parameters in my name to send a friend message.
After the final success, the following results can be seen in the easy-trust client:
Java invokes a friendly interface to a specified friend push message (ii) post test