Sample Code for Constellation query:
Using system;
Using system. Collections. Generic;
Using system. LINQ;
Using system. text;
Using system. net. Security;
Using system. Security. cryptography. x509certificates;
Using system. net;
Using system. IO;
Using system. Io. compression;
Using system. Text. regularexpressions;
Using system. Web. Script. serialization;
Namespace Map
{
Class Program
{
Static void main (string [] ARGs)
{
String key = "*********************";
String consname = "Aries ";
String type = "today ";
String url = "http://apis.haoservice.com/lifeservice/constellation/GetAll? Consname = "+ consname +" & type = "+ Type +" & Key = "+ key;
WebClient WC = new WebClient ();
WC. Encoding = encoding. utf8;
String STR = WC. downloadstring (URL );
Console. writeline (STR );
Console. readkey ();
}
}
}
Horoscope Operation Return example
Interface Information
URL: http://apis.haoservice.com/lifeservice/constellation/GetAll
Supported format: JSON
HTTP Request Method: Get post
Demo: http://apis.haoservice.com/lifeservice/constellation/GetAll? Consname = ARIES & type = Today & Key = The appkey you applied
Returned results:
/* Today's or tomorrow's fortune format */
{
"Error_code": 0,/* return code */
"Reason": "success ",
Result :{
"Name": "Leo",/* constellation name */
"Datetime": "June 27, 2014",/* date */
"Date": 20140627,
"All": "89%",/* overall index */
"Color": "Bronze",/* Lucky */
"Health": "95%",/* Health Index */
"Love": "80%",/* Love Index */
"Money": "84%",/* fortune Index */
"Number": 8,/* Lucky Number */
"Qfriend": "Virgo",/* quick constellation */
"Summary": "Some small thoughts may suddenly let you empty, and many details in your life make you feel a lot. ",/* Today's overview */
"Work": "80%",/* Work Index */
}
}
/* This week or next week's fortune format */
{
"Error_code": 0,
"Reason": "success ",
Result :{
"Name": "Aries ",
"Date": "June 29-20, 2014-July 05 ",
"Weekth": 27,
"Health": "Healthy: The body is anxious, but the body refuses to work hard to comfort. It is prone to stomach discomfort. ",
"Job": "Job Search: Although there are new ideas, it is easy to keep yourself calm. But it is more likely to get opportunities from family members. ",
"Love": "Romance: Previous accumulated thoughts and feelings. This week, I chose to talk about them. Communication opportunities increase, and quarrel may also occur. ",
"Money": "Fortune: although you have your own financial thoughts, you are generally controlled by the financial plans of your family or family. ",
"Work": "Work: this week is the end of Water reversal, and the opportunities for making up for the past are delayed and missed. It is possible to change the Department or position. "
}
}
Note:
1. First apply for the key value on the http://www.haoservice.com/docs/32 web page, and then run the Demo code.
2. for errors, refer to the error code.
Error code table:
Return Code Description
0 successful
Request key with 10001 Error
10002 this key has no request permission
The 10003 key expires.
SDK key with 10004 Error
10005 application not reviewed timeout. Please submit for authentication
10007 unknown request source (the server has not obtained an IP address)
10008 forbidden IP Address
10009 forbidden key
10011 the current IP request exceeds the limit
10012 the current key request has exceeded the limit.
10013 the test key exceeds the request limit
10020 interface Maintenance
10021 disable the interface
10022 the number of requests remaining on demand for the appkey is zero.
10023 invalid request IP Address
10024 network errors
10025 no results found
Constellation query DEMO code