|
接口信息 |
企业列表高级检索 |
请求方式:GET 地址:https://qcc.market.alicloudapi.com/qcc/query |
复 制 |
请求参数: (Body) |
字段名 |
变量名 |
必填 |
类型 |
示例值 |
描述 |
关键字 |
key |
是 |
String(32) |
拇指云 厦门 |
关键字检索(如企业名、统一社会信用代码、法人姓名等) |
页码 |
page |
否 |
Int |
1 |
页码(每页10条) |
API地址为https://qcc.market.alicloudapi.com/qcc/query,发起GET请求时,请确保在header中设置Authorization字段,格式为Authorization: APPCODE <您的AppCode>,其中<您的AppCode>替换为实际AppCode。注意:APPCODE与AppCode间有空格。
|
成功响应示例: |
|
成功报文解析: |
{
"ok": 1,
"msg": "请求成功",
"thispage": 1,
"pagecount": 12,
"count": 113,
"data": [{
"Name": "拇指云(厦门)软件有限公司",
"CardNo": "91350205MA8TE0P97L",
"Legal": "李建华",
"RegNo": "350205201072016",
"RegDay": "2021-06-17",
"RegStatus": "存续"
},
{
"Name": "厦门拇指云科技有限公司",
"CardNo": "91350203MA2YGWCE7D",
"Legal": "李建华",
"RegNo": "350203200798382",
"RegDay": "2017-08-17",
"RegStatus": "注销"
}
]
}
|
|
字段名 |
类型 |
示例值 |
描述 |
ok |
number |
1
|
成功标识:1成功,0失败
|
msg |
string |
请求成功
|
报文成败描述
|
thispage |
number |
1
|
当前数据所处页码
|
pagecount |
number |
12
|
最大页码
|
count |
number |
113
|
查询结果数量
|
data |
object |
[{...}]
|
查询结果数据包
|
Name |
string |
拇指云(厦门)软件有限公司
|
企业全称
|
CardNo |
string |
91350205MA8TE0P97L
|
社会统一信用代码
|
Legal |
string |
李建华
|
法人姓名
|
RegNo |
string |
350205201072016
|
注册号或企业编号
|
RegDay |
string |
2021-06-17
|
成立日期
|
RegStatus |
string |
存续
|
企业状态 |
|
失败响应示例: |
|
失败报文解析: |
{
"ok": 0,
"msg": "未传入正确的key字段:关键字"
}
|
|
字段名 |
类型 |
示例值 |
描述 |
ok |
number |
0 |
成功标识:1成功,0失败 |
msg |
string |
未传入正确的key字段:关键字
|
报文成败描述 |
|
|
|
PHP代码 |
注意AppCode安全,验证API参数,处理HTTPS请求时禁用证书验证风险。 |
复 制 |
|
<?php
$host = "https://qcc.market.alicloudapi.com";
$path = "/qcc/query";
$method = "GET";
$appcode = "你自己的AppCode";
$headers = array();
array_push($headers, "Authorization:APPCODE " . $appcode);
$querys = "key=%E6%8B%87%E6%8C%87%E4%BA%91+%E5%8E%A6%E9%97%A8&page=1";
$bodys = "";
$url = $host . $path . "?" . $querys;
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_FAILONERROR, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, true);
if (1 == strpos("$".$host, "https://"))
{
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
}
var_dump(curl_exec($curl));
?>
|
|
Java代码 |
注意API URL、AppCode正确性,并确保处理HTTPS请求时SSL验证配置。 |
复 制 |
|
public static void main(String[] args) {
String host = "https://qcc.market.alicloudapi.com";
String path = "/qcc/query";
String method = "GET";
String appcode = "你自己的AppCode";
Map headers = new HashMap();
//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
headers.put("Authorization", "APPCODE " + appcode);
Map querys = new HashMap();
querys.put("key", "拇指云 厦门");
querys.put("page", "1");
try {
/**
* 重要提示如下:
* HttpUtils请从
* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/src/main/java/com/aliyun/api/gateway/demo/util/HttpUtils.java
* 下载
*
* 相应的依赖请参照
* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/pom.xml
*/
HttpResponse response = HttpUtils.doGet(host, path, method, headers, querys);
System.out.println(response.toString());
//获取response的body
//System.out.println(EntityUtils.toString(response.getEntity()));
} catch (Exception e) {
e.printStackTrace();
}
}
|
|
C#代码 |
注意处理HTTPS请求时的SSL证书验证,确保AppCode和URL正确性。 |
复 制 |
|
//using System.IO;
//using System.Text;
//using System.Net;
//using System.Net.Security;
//using System.Security.Cryptography.X509Certificates;
private const String host = "https://qcc.market.alicloudapi.com";
private const String path = "/qcc/query";
private const String method = "GET";
private const String appcode = "你自己的AppCode";
static void Main(string[] args)
{
String querys = "key=%E6%8B%87%E6%8C%87%E4%BA%91+%E5%8E%A6%E9%97%A8&page=1";
String bodys = "";
String url = host + path;
HttpWebRequest httpRequest = null;
HttpWebResponse httpResponse = null;
if (0 < querys.Length)
{
url = url + "?" + querys;
}
if (host.Contains("https://"))
{
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url));
}
else
{
httpRequest = (HttpWebRequest)WebRequest.Create(url);
}
httpRequest.Method = method;
httpRequest.Headers.Add("Authorization", "APPCODE " + appcode);
if (0 < bodys.Length)
{
byte[] data = Encoding.UTF8.GetBytes(bodys);
using (Stream stream = httpRequest.GetRequestStream())
{
stream.Write(data, 0, data.Length);
}
}
try
{
httpResponse = (HttpWebResponse)httpRequest.GetResponse();
}
catch (WebException ex)
{
httpResponse = (HttpWebResponse)ex.Response;
}
Console.WriteLine(httpResponse.StatusCode);
Console.WriteLine(httpResponse.Method);
Console.WriteLine(httpResponse.Headers);
Stream st = httpResponse.GetResponseStream();
StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8"));
Console.WriteLine(reader.ReadToEnd());
Console.WriteLine("\n");
}
public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
{
return true;
}
|
|
Python代码 |
urllib2在Python 3中已被弃用,Python 3用户应使用urllib.request模块。 |
复 制 |
|
import urllib, urllib2, sys
import ssl
host = 'https://qcc.market.alicloudapi.com'
path = '/qcc/query'
method = 'GET'
appcode = '你自己的AppCode'
querys = 'key=%E6%8B%87%E6%8C%87%E4%BA%91+%E5%8E%A6%E9%97%A8&page=1'
bodys = {}
url = host + path + '?' + querys
request = urllib2.Request(url)
request.add_header('Authorization', 'APPCODE ' + appcode)
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
response = urllib2.urlopen(request, context=ctx)
content = response.read()
if (content):
print(content)
|
|
ObjectC代码 |
拼接URL时,?开头查询字符串可行。建议使用NSURLComponents。缓存策略按需设,超时时间可调。 |
复 制 |
|
NSString *appcode = @"你自己的AppCode";
NSString *host = @"https://qcc.market.alicloudapi.com";
NSString *path = @"/qcc/query";
NSString *method = @"GET";
NSString *querys = @"?key=%E6%8B%87%E6%8C%87%E4%BA%91+%E5%8E%A6%E9%97%A8&page=1";
NSString *url = [NSString stringWithFormat:@"%@%@%@", host, path , querys];
NSString *bodys = @"";
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString: url] cachePolicy:1 timeoutInterval: 5];
request.HTTPMethod = method;
[request addValue: [NSString stringWithFormat:@"APPCODE %@" , appcode] forHTTPHeaderField: @"Authorization"];
NSURLSession *requestSession = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
NSURLSessionDataTask *task = [requestSession dataTaskWithRequest:request
completionHandler:^(NSData * _Nullable body , NSURLResponse * _Nullable response, NSError * _Nullable error) {
NSLog(@"Response object: %@" , response);
NSString *bodyString = [[NSString alloc] initWithData:body encoding:NSUTF8StringEncoding];
//打印应答中的body
NSLog(@"Response body: %@" , bodyString);
}];
[task resume];
|
|
curl代码 |
|
复 制 |
|
curl -i -k --get --include 'https://qcc.market.alicloudapi.com/qcc/query?key=%E6%8B%87%E6%8C%87%E4%BA%91+%E5%8E%A6%E9%97%A8&page=1' -H 'Authorization:APPCODE 你自己的AppCode'
|