

优质服务商家
5*8小时在线客服
专业测试保证品质
API文档
企业基本信息
调用地址:http://service-p14a7xcb-1255468759.ap-shanghai.apigateway.myqcloud.com/release/1672-4
请求方式:GET
返回类型:HTML
请求参数(Headers)
名称
|
类型
|
是否必须
|
描述
|
---|---|---|---|
暂无数据
|
请求参数(Query)
名称
|
类型
|
是否必须
|
描述
|
---|---|---|---|
id
|
string
|
否
|
企业id,这个参数请通过另一个接入点【企业搜索】获取。 注意(企业ID或企业名称是二选一、这个不是组织机构代码)
|
name
|
string
|
否
|
企业名字(最好输入完整的) 注意(企业ID或企业名称是二选一)
|
请求参数(Body)
名称
|
类型
|
是否必须
|
描述
|
---|---|---|---|
暂无数据
|
请求示例
curl -v -X GET http://service-p14a7xcb-1255468759.ap-shanghai.apigateway.myqcloud.com/release/1672-4 ?id=&name=-H 'Host:service-p14a7xcb-1255468759.ap-shanghai.apigateway.myqcloud.com' -H 'Source:source' -H 'Date:Mon, 19 Mar 2018 12:08:40 GMT' -H 'Authorization:hmac id = "AKIDi6qE41WgJ9w8h4h9zq68Vq24d1beIuN0qIwU", algorithm = "hmac-sha1", headers = "date source", signature = yMCxXNytW5nvVGNZ8aBtRxmiLJ4=' -H 'X-Requested-With:XMLHttpRequest'
//请用云市场分配给您的密钥计算签名并放入请求头,Date为当前的GMT时间
package main
import (
"crypto/hmac"
"crypto/sha1"
"encoding/base64"
"fmt"
"io"
"io/ioutil"
"net/http"
gourl "net/url"
"strings"
"time"
)
func calcAuthorization(source string, secretId string, secretKey string) (auth string, datetime string, err error) {
timeLocation, _ := time.LoadLocation("Etc/GMT")
datetime = time.Now().In(timeLocation).Format("Mon, 02 Jan 2006 15:04:05 GMT")
signStr := fmt.Sprintf("x-date: %s\nx-source: %s", datetime, source)
// hmac-sha1
mac := hmac.New(sha1.New, []byte(secretKey))
mac.Write([]byte(signStr))
sign := base64.StdEncoding.EncodeToString(mac.Sum(nil))
auth = fmt.Sprintf("hmac id=\"%s\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"%s\"",
secretId, sign)
return auth, datetime, nil
}
func urlencode(params map[string]string) string {
var p = gourl.Values{}
for k, v := range params {
p.Add(k, v)
}
return p.Encode()
}
func main() {
// 云市场分配的密钥Id
secretId := "xxxx"
// 云市场分配的密钥Key
secretKey := "xxxx"
source := "market"
// 签名
auth, datetime, _ := calcAuthorization(source, secretId, secretKey)
// 请求方法
method := "GET"
// 请求头
headers := map[string]string{"X-Source": source, "X-Date": datetime, "Authorization": auth}
// 查询参数
queryParams := make(map[string]string)
queryParams["id"] = ""
queryParams["name"] = ""
// body参数
bodyParams := make(map[string]string)
// url参数拼接
url := "http://service-p14a7xcb-1255468759.ap-shanghai.apigateway.myqcloud.com/release/1672-4"
if len(queryParams) > 0 {
url = fmt.Sprintf("%s?%s", url, urlencode(queryParams))
}
bodyMethods := map[string]bool{"POST": true, "PUT": true, "PATCH": true}
var body io.Reader = nil
if bodyMethods[method] {
body = strings.NewReader(urlencode(bodyParams))
headers["Content-Type"] = "application/x-www-form-urlencoded"
}
client := &http.Client{
Timeout: 5 * time.Second,
}
request, err := http.NewRequest(method, url, body)
if err != nil {
panic(err)
}
for k, v := range headers {
request.Header.Set(k, v)
}
response, err := client.Do(request)
if err != nil {
panic(err)
}
defer response.Body.Close()
bodyBytes, err := ioutil.ReadAll(response.Body)
if err != nil {
panic(err)
}
fmt.Println(string(bodyBytes))
}
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import sun.misc.BASE64Encoder;
class Demo {
public static String calcAuthorization(String source, String secretId, String secretKey, String datetime)
throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException {
String signStr = "x-date: " + datetime + "\n" + "x-source: " + source;
Mac mac = Mac.getInstance("HmacSHA1");
Key sKey = new SecretKeySpec(secretKey.getBytes("UTF-8"), mac.getAlgorithm());
mac.init(sKey);
byte[] hash = mac.doFinal(signStr.getBytes("UTF-8"));
String sig = new BASE64Encoder().encode(hash);
String auth = "hmac id=\"" + secretId + "\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"" + sig + "\"";
return auth;
}
public static String urlencode(Map<?, ?> map) throws UnsupportedEncodingException {
StringBuilder sb = new StringBuilder();
for (Map.Entry<?, ?> entry : map.entrySet()) {
if (sb.length() > 0) {
sb.append("&");
}
sb.append(String.format("%s=%s",
URLEncoder.encode(entry.getKey().toString(), "UTF-8"),
URLEncoder.encode(entry.getValue().toString(), "UTF-8")
));
}
return sb.toString();
}
public static void main(String[] args) throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException {
//云市场分配的密钥Id
String secretId = "xxxx";
//云市场分配的密钥Key
String secretKey = "xxxx";
String source = "market";
Calendar cd = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.US);
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
String datetime = sdf.format(cd.getTime());
// 签名
String auth = calcAuthorization(source, secretId, secretKey, datetime);
// 请求方法
String method = "GET";
// 请求头
Map<String, String> headers = new HashMap<String, String>();
headers.put("X-Source", source);
headers.put("X-Date", datetime);
headers.put("Authorization", auth);
// 查询参数
Map<String, String> queryParams = new HashMap<String, String>();
queryParams.put("id","");
queryParams.put("name","");
// body参数
Map<String, String> bodyParams = new HashMap<String, String>();
// url参数拼接
String url = "http://service-p14a7xcb-1255468759.ap-shanghai.apigateway.myqcloud.com/release/1672-4";
if (!queryParams.isEmpty()) {
url += "?" + urlencode(queryParams);
}
BufferedReader in = null;
try {
URL realUrl = new URL(url);
HttpURLConnection conn = (HttpURLConnection) realUrl.openConnection();
conn.setConnectTimeout(5000);
conn.setReadTimeout(5000);
conn.setRequestMethod(method);
// request headers
for (Map.Entry<String, String> entry : headers.entrySet()) {
conn.setRequestProperty(entry.getKey(), entry.getValue());
}
// request body
Map<String, Boolean> methods = new HashMap<>();
methods.put("POST", true);
methods.put("PUT", true);
methods.put("PATCH", true);
Boolean hasBody = methods.get(method);
if (hasBody != null) {
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setDoOutput(true);
DataOutputStream out = new DataOutputStream(conn.getOutputStream());
out.writeBytes(urlencode(bodyParams));
out.flush();
out.close();
}
// 定义 BufferedReader输入流来读取URL的响应
in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
String result = "";
while ((line = in.readLine()) != null) {
result += line;
}
System.out.println(result);
} catch (Exception e) {
System.out.println(e);
e.printStackTrace();
} finally {
try {
if (in != null) {
in.close();
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
}
}
/**
* npm install crypto-js request
*/
var CryptoJS = require("crypto-js");
var request = require('request');
var querystring = require('querystring');
// 云市场分配的密钥Id
var secretId = "xxx";
// 云市场分配的密钥Key
var secretKey = "xxx";
var source = "market";
// 签名
var datetime = (new Date()).toGMTString();
var signStr = "x-date: " + datetime + "\n" + "x-source: " + source;
var sign = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA1(signStr, secretKey))
var auth = 'hmac id="' + secretId + '", algorithm="hmac-sha1", headers="x-date x-source", signature="' + sign + '"';
// 请求方法
var method = "GET";
// 请求头
var headers = {
"X-Source": source,
"X-Date": datetime,
"Authorization": auth,
}
// 查询参数
var queryParams = {
"id": "",
"name": ""}
// body参数(POST方法下)
var bodyParams = {
}
// url参数拼接
var url = "http://service-p14a7xcb-1255468759.ap-shanghai.apigateway.myqcloud.com/release/1672-4";
if (Object.keys(queryParams).length > 0) {
url += '?' + querystring.stringify(queryParams);
}
var options = {
url: url,
timeout: 5000,
method: method,
headers: headers
}
if (['POST', 'PUT', 'PATCH'].indexOf(method) != -1) {
options['body'] = querystring.stringify(bodyParams);
options['headers']['Content-Type'] = "application/x-www-form-urlencoded";
}
request(options, function (error, response, body) {
if (error !== null) {
console.log('error:', error);
return;
}
console.log(body);
});
<?php
// 云市场分配的密钥Id
$secretId = 'xxxx';
// 云市场分配的密钥Key
$secretKey = 'xxxx';
$source = 'market';
// 签名
$datetime = gmdate('D, d M Y H:i:s T');
$signStr = sprintf("x-date: %s\nx-source: %s", $datetime, $source);
$sign = base64_encode(hash_hmac('sha1', $signStr, $secretKey, true));
$auth = sprintf('hmac id="%s", algorithm="hmac-sha1", headers="x-date x-source", signature="%s"', $secretId, $sign);
// 请求方法
$method = 'GET';
// 请求头
$headers = array(
'X-Source' => $source,
'X-Date' => $datetime,
'Authorization' => $auth,
);
// 查询参数
$queryParams = array (
'id' => '',
'name' => '',
);
// body参数(POST方法下)
$bodyParams = array (
);
// url参数拼接
$url = 'http://service-p14a7xcb-1255468759.ap-shanghai.apigateway.myqcloud.com/release/1672-4';
if (count($queryParams) > 0) {
$url .= '?' . http_build_query($queryParams);
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, array_map(function ($v, $k) {
return $k . ': ' . $v;
}, array_values($headers), array_keys($headers)));
if (in_array($method, array('POST', 'PUT', 'PATCH'), true)) {
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($bodyParams));
}
$data = curl_exec($ch);
if (curl_errno($ch)) {
echo "Error: " . curl_error($ch);
} else {
print_r($data);
}
curl_close($ch);
# -*- coding: utf-8 -*-
from __future__ import print_function
import ssl, hmac, base64, hashlib
from datetime import datetime as pydatetime
try:
from urllib import urlencode
from urllib2 import Request, urlopen
except ImportError:
from urllib.parse import urlencode
from urllib.request import Request, urlopen
# 云市场分配的密钥Id
secretId = "xxxx"
# 云市场分配的密钥Key
secretKey = "xxxx"
source = "market"
# 签名
datetime = pydatetime.utcnow().strftime('%a, %d %b %Y %H:%M:%S GMT')
signStr = "x-date: %s\nx-source: %s" % (datetime, source)
sign = base64.b64encode(hmac.new(secretKey.encode('utf-8'), signStr.encode('utf-8'), hashlib.sha1).digest())
auth = 'hmac id="%s", algorithm="hmac-sha1", headers="x-date x-source", signature="%s"' % (secretId, sign.decode('utf-8'))
# 请求方法
method = 'GET'
# 请求头
headers = {
'X-Source': source,
'X-Date': datetime,
'Authorization': auth,
}
# 查询参数
queryParams = {
"id": "",
"name": ""}
# body参数(POST方法下存在)
bodyParams = {
}
# url参数拼接
url = 'http://service-p14a7xcb-1255468759.ap-shanghai.apigateway.myqcloud.com/release/1672-4'
if len(queryParams.keys()) > 0:
url = url + '?' + urlencode(queryParams)
request = Request(url, headers=headers)
request.get_method = lambda: method
if method in ('POST', 'PUT', 'PATCH'):
request.data = urlencode(bodyParams).encode('utf-8')
request.add_header('Content-Type', 'application/x-www-form-urlencoded')
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
response = urlopen(request, context=ctx)
content = response.read()
if content:
print(content.decode('utf-8'))
using System.IO;
using System.Text;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System;
public class CsharpTest
{
public static String HMACSHA1Text(String EncryptText, String EncryptKey)
{
HMACSHA1 hmacsha1 = new HMACSHA1();
hmacsha1.Key = System.Text.Encoding.UTF8.GetBytes(EncryptKey);
byte[] dataBuffer = System.Text.Encoding.UTF8.GetBytes(EncryptText);
byte[] hashBytes = hmacsha1.ComputeHash(dataBuffer);
return Convert.ToBase64String(hashBytes);
}
public static void Main(String[] args)
{
String url = "http://service-p14a7xcb-1255468759.ap-shanghai.apigateway.myqcloud.com/release/1672-4";
String method = "GET";
String querys = "id=&name=";
String source = "market";
//云市场分配的密钥Id
String secretId = "xxx";
//云市场分配的密钥Key
String secretKey = "xxx";
String dt = DateTime.UtcNow.GetDateTimeFormats('r')[0];
url = url + "?" + querys;
String signStr = "x-date: " + dt + "\n" + "x-source: " + source;
String sign = HMACSHA1Text(signStr, secretKey);
String auth = "hmac id=\"" + secretId + "\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"";
auth = auth + sign + "\"";
Console.WriteLine(auth + "\n");
HttpWebRequest httpRequest = null;
HttpWebResponse httpResponse = null;
if (url.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", auth);
httpRequest.Headers.Add("X-Source", source);
httpRequest.Headers.Add("X-Date", dt);
try
{
httpResponse = (HttpWebResponse)httpRequest.GetResponse();
}
catch (WebException ex)
{
httpResponse = (HttpWebResponse)ex.Response;
}
Console.WriteLine(httpResponse.StatusCode);
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;
}
}
正常返回示例
{
"showapi_res_error": "",
"showapi_res_id": "cbeecda28431409287d4a47e9dc69687",
"showapi_res_code": 0,
"showapi_res_body": {
"result": {
"regNumber": "530111000293593",
"regCapital": "100万人民币",
"socialStaffNum": 6,
"staffList": {
"result": [
{
"toco": 2,
"typeJoin": [
"执行董事兼总经理"
],
"name": "蔡雪焘",
"id": 2157270012,
"type": 2
},
{
"toco": 2,
"typeJoin": [
"监事"
],
"name": "兰文栋",
"id": 1797059833,
"type": 2
}
],
"total": 2
},
"alias": "秀派科技",
"flag": 1,
"staffNumRange": "小于50人",
"sourceFlag": "http://qyxy.baic.gov.cn/",
"companyOrgType": "有限责任公司(自然人投资或控股)",
"fromTime": 1427731200000,
"base": "yn",
"toTime": 3005568000000,
"type": 1,
"industry": "软件和信息技术服务业",
"taxNumber": "915301113365399588",
"businessScope": "软件开发;互联网科技创新平台;互联网数据服务;互联网销售;信息系统集成和物联网技术服务;信息处理和存储支持服务;信息技术咨询服务;数字内容服务;运行维护服务(依法须经批准的项目,经相关部门批准后方可开展经营活动)",
"companyTableId": 13558958,
"phoneNumber": "13700645500",
"legalPersonId": 2157270012,
"creditCode": "915301113365399588",
"regInstitute": "五华区市场监督管理局",
"logo": "http://img.tianyancha.com/logo/lll/32f10ebb287ba203d3829f65cf3b57c8.png@!f_200x200",
"actualCapital": "",
"companyName": "昆明秀派科技有限公司",
"categoryScore": 3746,
"websiteList": "www.showapi.com",
"regStatus": "存续",
"regLocation": "云南省昆明市五华区学府路745号海伦先生1栋1712号写字楼",
"correctCompanyId": "",
"updatetime": 1533865057747,
"approvedTime": 1529337600000,
"legalPersonName": "蔡雪焘",
"companyId": 682802261,
"percentileScore": 7027,
"orgNumber": "336539958",
"estiblishTime": 1427731200000,
"updateTimes": 1533865056000
},
"msg": "查询成功",
"msgCode": 0,
"ret_code": 0
}
}
失败返回示例
{
"showapi_res_error": "",
"showapi_res_id": "2c985f552ad849379a5565c41c61d82e",
"showapi_res_code": 0,
"showapi_res_body": {
"msg": "参数不符合,查询不到相应结果",
"msgCode": 1,
"ret_code": -1
}
}
返回码定义
返回码
|
返回信息
|
描述
|
---|---|---|
无参数
|
企业搜索
调用地址:http://service-p14a7xcb-1255468759.ap-shanghai.apigateway.myqcloud.com/release/1672-1
请求方式:GET
返回类型:HTML
请求参数(Headers)
名称
|
类型
|
是否必须
|
描述
|
---|---|---|---|
keyWords
|
string
|
是
|
关键字:公司名称、人名、产品名称、老板名称、高管名称、联系方式、工商注册号、组织机构代码、统一信用代码等进行搜索
|
请求参数(Query)
名称
|
类型
|
是否必须
|
描述
|
---|---|---|---|
暂无数据
|
请求参数(Body)
名称
|
类型
|
是否必须
|
描述
|
---|---|---|---|
暂无数据
|
请求示例
curl -v -X GET http://service-p14a7xcb-1255468759.ap-shanghai.apigateway.myqcloud.com/release/1672-1 -H 'Host:service-p14a7xcb-1255468759.ap-shanghai.apigateway.myqcloud.com' -H 'Source:source' -H 'Date:Mon, 19 Mar 2018 12:08:40 GMT' -H 'Authorization:hmac id = "AKIDi6qE41WgJ9w8h4h9zq68Vq24d1beIuN0qIwU", algorithm = "hmac-sha1", headers = "date source", signature = yMCxXNytW5nvVGNZ8aBtRxmiLJ4=' -H 'X-Requested-With:XMLHttpRequest' -H 'keyWords:'
//请用云市场分配给您的密钥计算签名并放入请求头,Date为当前的GMT时间
package main
import (
"crypto/hmac"
"crypto/sha1"
"encoding/base64"
"fmt"
"io"
"io/ioutil"
"net/http"
gourl "net/url"
"strings"
"time"
)
func calcAuthorization(source string, secretId string, secretKey string) (auth string, datetime string, err error) {
timeLocation, _ := time.LoadLocation("Etc/GMT")
datetime = time.Now().In(timeLocation).Format("Mon, 02 Jan 2006 15:04:05 GMT")
signStr := fmt.Sprintf("x-date: %s\nx-source: %s", datetime, source)
// hmac-sha1
mac := hmac.New(sha1.New, []byte(secretKey))
mac.Write([]byte(signStr))
sign := base64.StdEncoding.EncodeToString(mac.Sum(nil))
auth = fmt.Sprintf("hmac id=\"%s\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"%s\"",
secretId, sign)
return auth, datetime, nil
}
func urlencode(params map[string]string) string {
var p = gourl.Values{}
for k, v := range params {
p.Add(k, v)
}
return p.Encode()
}
func main() {
// 云市场分配的密钥Id
secretId := "xxxx"
// 云市场分配的密钥Key
secretKey := "xxxx"
source := "market"
// 签名
auth, datetime, _ := calcAuthorization(source, secretId, secretKey)
// 请求方法
method := "GET"
// 请求头
headers := map[string]string{"X-Source": source, "X-Date": datetime, "Authorization": auth}
headers["keyWords"] = ""
// 查询参数
queryParams := make(map[string]string)
// body参数
bodyParams := make(map[string]string)
// url参数拼接
url := "http://service-p14a7xcb-1255468759.ap-shanghai.apigateway.myqcloud.com/release/1672-1"
if len(queryParams) > 0 {
url = fmt.Sprintf("%s?%s", url, urlencode(queryParams))
}
bodyMethods := map[string]bool{"POST": true, "PUT": true, "PATCH": true}
var body io.Reader = nil
if bodyMethods[method] {
body = strings.NewReader(urlencode(bodyParams))
headers["Content-Type"] = "application/x-www-form-urlencoded"
}
client := &http.Client{
Timeout: 5 * time.Second,
}
request, err := http.NewRequest(method, url, body)
if err != nil {
panic(err)
}
for k, v := range headers {
request.Header.Set(k, v)
}
response, err := client.Do(request)
if err != nil {
panic(err)
}
defer response.Body.Close()
bodyBytes, err := ioutil.ReadAll(response.Body)
if err != nil {
panic(err)
}
fmt.Println(string(bodyBytes))
}
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import sun.misc.BASE64Encoder;
class Demo {
public static String calcAuthorization(String source, String secretId, String secretKey, String datetime)
throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException {
String signStr = "x-date: " + datetime + "\n" + "x-source: " + source;
Mac mac = Mac.getInstance("HmacSHA1");
Key sKey = new SecretKeySpec(secretKey.getBytes("UTF-8"), mac.getAlgorithm());
mac.init(sKey);
byte[] hash = mac.doFinal(signStr.getBytes("UTF-8"));
String sig = new BASE64Encoder().encode(hash);
String auth = "hmac id=\"" + secretId + "\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"" + sig + "\"";
return auth;
}
public static String urlencode(Map<?, ?> map) throws UnsupportedEncodingException {
StringBuilder sb = new StringBuilder();
for (Map.Entry<?, ?> entry : map.entrySet()) {
if (sb.length() > 0) {
sb.append("&");
}
sb.append(String.format("%s=%s",
URLEncoder.encode(entry.getKey().toString(), "UTF-8"),
URLEncoder.encode(entry.getValue().toString(), "UTF-8")
));
}
return sb.toString();
}
public static void main(String[] args) throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException {
//云市场分配的密钥Id
String secretId = "xxxx";
//云市场分配的密钥Key
String secretKey = "xxxx";
String source = "market";
Calendar cd = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.US);
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
String datetime = sdf.format(cd.getTime());
// 签名
String auth = calcAuthorization(source, secretId, secretKey, datetime);
// 请求方法
String method = "GET";
// 请求头
Map<String, String> headers = new HashMap<String, String>();
headers.put("X-Source", source);
headers.put("X-Date", datetime);
headers.put("Authorization", auth);
headers.put("keyWords","");
// 查询参数
Map<String, String> queryParams = new HashMap<String, String>();
// body参数
Map<String, String> bodyParams = new HashMap<String, String>();
// url参数拼接
String url = "http://service-p14a7xcb-1255468759.ap-shanghai.apigateway.myqcloud.com/release/1672-1";
if (!queryParams.isEmpty()) {
url += "?" + urlencode(queryParams);
}
BufferedReader in = null;
try {
URL realUrl = new URL(url);
HttpURLConnection conn = (HttpURLConnection) realUrl.openConnection();
conn.setConnectTimeout(5000);
conn.setReadTimeout(5000);
conn.setRequestMethod(method);
// request headers
for (Map.Entry<String, String> entry : headers.entrySet()) {
conn.setRequestProperty(entry.getKey(), entry.getValue());
}
// request body
Map<String, Boolean> methods = new HashMap<>();
methods.put("POST", true);
methods.put("PUT", true);
methods.put("PATCH", true);
Boolean hasBody = methods.get(method);
if (hasBody != null) {
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setDoOutput(true);
DataOutputStream out = new DataOutputStream(conn.getOutputStream());
out.writeBytes(urlencode(bodyParams));
out.flush();
out.close();
}
// 定义 BufferedReader输入流来读取URL的响应
in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
String result = "";
while ((line = in.readLine()) != null) {
result += line;
}
System.out.println(result);
} catch (Exception e) {
System.out.println(e);
e.printStackTrace();
} finally {
try {
if (in != null) {
in.close();
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
}
}
/**
* npm install crypto-js request
*/
var CryptoJS = require("crypto-js");
var request = require('request');
var querystring = require('querystring');
// 云市场分配的密钥Id
var secretId = "xxx";
// 云市场分配的密钥Key
var secretKey = "xxx";
var source = "market";
// 签名
var datetime = (new Date()).toGMTString();
var signStr = "x-date: " + datetime + "\n" + "x-source: " + source;
var sign = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA1(signStr, secretKey))
var auth = 'hmac id="' + secretId + '", algorithm="hmac-sha1", headers="x-date x-source", signature="' + sign + '"';
// 请求方法
var method = "GET";
// 请求头
var headers = {
"X-Source": source,
"X-Date": datetime,
"Authorization": auth,
"keyWords": ""
<?php
// 云市场分配的密钥Id
$secretId = 'xxxx';
// 云市场分配的密钥Key
$secretKey = 'xxxx';
$source = 'market';
// 签名
$datetime = gmdate('D, d M Y H:i:s T');
$signStr = sprintf("x-date: %s\nx-source: %s", $datetime, $source);
$sign = base64_encode(hash_hmac('sha1', $signStr, $secretKey, true));
$auth = sprintf('hmac id="%s", algorithm="hmac-sha1", headers="x-date x-source", signature="%s"', $secretId, $sign);
// 请求方法
$method = 'GET';
// 请求头
$headers = array(
'X-Source' => $source,
'X-Date' => $datetime,
'Authorization' => $auth,
'keyWords' => '',
# -*- coding: utf-8 -*-
from __future__ import print_function
import ssl, hmac, base64, hashlib
from datetime import datetime as pydatetime
try:
from urllib import urlencode
from urllib2 import Request, urlopen
except ImportError:
from urllib.parse import urlencode
from urllib.request import Request, urlopen
# 云市场分配的密钥Id
secretId = "xxxx"
# 云市场分配的密钥Key
secretKey = "xxxx"
source = "market"
# 签名
datetime = pydatetime.utcnow().strftime('%a, %d %b %Y %H:%M:%S GMT')
signStr = "x-date: %s\nx-source: %s" % (datetime, source)
sign = base64.b64encode(hmac.new(secretKey.encode('utf-8'), signStr.encode('utf-8'), hashlib.sha1).digest())
auth = 'hmac id="%s", algorithm="hmac-sha1", headers="x-date x-source", signature="%s"' % (secretId, sign.decode('utf-8'))
# 请求方法
method = 'GET'
# 请求头
headers = {
'X-Source': source,
'X-Date': datetime,
'Authorization': auth,
"keyWords": ""
using System.IO;
using System.Text;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System;
public class CsharpTest
{
public static String HMACSHA1Text(String EncryptText, String EncryptKey)
{
HMACSHA1 hmacsha1 = new HMACSHA1();
hmacsha1.Key = System.Text.Encoding.UTF8.GetBytes(EncryptKey);
byte[] dataBuffer = System.Text.Encoding.UTF8.GetBytes(EncryptText);
byte[] hashBytes = hmacsha1.ComputeHash(dataBuffer);
return Convert.ToBase64String(hashBytes);
}
public static void Main(String[] args)
{
String url = "http://service-p14a7xcb-1255468759.ap-shanghai.apigateway.myqcloud.com/release/1672-1";
String method = "GET";
String querys = "";
String source = "market";
//云市场分配的密钥Id
String secretId = "xxx";
//云市场分配的密钥Key
String secretKey = "xxx";
String dt = DateTime.UtcNow.GetDateTimeFormats('r')[0];
url = url + "?" + querys;
String signStr = "x-date: " + dt + "\n" + "x-source: " + source;
String sign = HMACSHA1Text(signStr, secretKey);
String auth = "hmac id=\"" + secretId + "\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"";
auth = auth + sign + "\"";
Console.WriteLine(auth + "\n");
HttpWebRequest httpRequest = null;
HttpWebResponse httpResponse = null;
if (url.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", auth);
httpRequest.Headers.Add("X-Source", source);
httpRequest.Headers.Add("X-Date", dt);
try
{
httpResponse = (HttpWebResponse)httpRequest.GetResponse();
}
catch (WebException ex)
{
httpResponse = (HttpWebResponse)ex.Response;
}
Console.WriteLine(httpResponse.StatusCode);
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;
}
}
正常返回示例
{
"showapi_res_error": "",
"showapi_res_id": "ac7afde6c4e54facac790318c2ff2ae3",
"showapi_res_code": 0,
"showapi_res_body": {
"msg": "查询成功",
"result": [
{
"regCapital": "8116414万人民币",
"companyType": 1,
"name": "中国铁路昆明局集团有限公司",
"base": "云南",
"legalPersonName": "周荣",
"id": 3116046669,
"htmlName": "中国铁路<em>昆明</em>局集团有限公司",
"estiblishTime": "1997-01-30 00:00:00.0",
"type": 1
},
{
"regCapital": "32012.644264万人民币",
"companyType": 1,
"name": "昆明公交集团有限责任公司",
"base": "云南",
"legalPersonName": "苗献军",
"id": 237622292,
"htmlName": "<em>昆明</em>公交集团有限责任公司",
"estiblishTime": "1982-03-11 00:00:00.0",
"type": 1
},
{
"regCapital": "590万人民币",
"companyType": 1,
"name": "昆明康辉旅行社有限公司",
"base": "云南",
"legalPersonName": "白凡",
"id": 290081882,
"htmlName": "<em>昆明</em>康辉旅行社有限公司",
"estiblishTime": "1999-10-28 00:00:00.0",
"type": 1
},
{
"regCapital": "78619.7697万人民币",
"companyType": 1,
"name": "昆药集团股份有限公司",
"base": "云南",
"legalPersonName": "钟祥刚",
"id": 332945115,
"htmlName": "昆药集团股份有限公司",
"estiblishTime": "1995-12-14 00:00:00.0",
"type": 1
},
{
"regCapital": "20000万人民币",
"companyType": 1,
"name": "昆明电缆集团股份有限公司",
"base": "云南",
"legalPersonName": "张建友",
"id": 292442691,
"htmlName": "<em>昆明</em>电缆集团股份有限公司",
"estiblishTime": "1996-12-28 00:00:00.0",
"type": 1
},
{
"regCapital": "46583万人民币",
"companyType": 1,
"name": "昆明煤气(集团)控股有限公司",
"base": "云南",
"legalPersonName": "文勇",
"id": 248891059,
"htmlName": "<em>昆明</em>煤气(集团)控股有限公司",
"estiblishTime": "1986-12-02 00:00:00.0",
"type": 1
},
{
"regCapital": "-",
"companyType": 1,
"name": "中国铁路昆明局集团有限公司昆明供电段",
"base": "云南",
"legalPersonName": "王雄桓",
"id": 3145468769,
"htmlName": "中国铁路<em>昆明</em>局集团有限公司昆明供电段",
"estiblishTime": "2013-12-16 00:00:00.0",
"type": 1
},
{
"regCapital": "3800万人民币",
"companyType": 1,
"name": "昆明华曦牧业集团有限公司",
"base": "云南",
"legalPersonName": "马迅",
"id": 352850752,
"htmlName": "<em>昆明</em>华曦牧业集团有限公司",
"estiblishTime": "1999-03-02 00:00:00.0",
"type": 1
},
{
"regCapital": "100000万人民币",
"companyType": 1,
"name": "昆明轨道交通集团有限公司",
"base": "云南",
"legalPersonName": "宗庆生",
"id": 221199156,
"htmlName": "<em>昆明</em>轨道交通集团有限公司",
"estiblishTime": "2008-12-24 00:00:00.0",
"type": 1
},
{
"regCapital": "3019.9万人民币",
"companyType": 1,
"name": "昆明新知集团有限公司",
"base": "云南",
"legalPersonName": "李勇",
"id": 216191804,
"htmlName": "<em>昆明</em>新知集团有限公司",
"estiblishTime": "1991-04-05 00:00:00.0",
"type": 1
},
{
"regCapital": "20万人民币",
"companyType": 1,
"name": "昆明温莎文化发展有限公司",
"base": "云南",
"legalPersonName": "魏崴",
"id": 16341442,
"htmlName": "<em>昆明</em>温莎文化发展有限公司",
"estiblishTime": "2010-12-22 00:00:00.0",
"type": 1
},
{
"regCapital": "1322万人民币",
"companyType": 1,
"name": "昆明交运经贸有限公司",
"base": "云南",
"legalPersonName": "宋绍林",
"id": 358022943,
"htmlName": "<em>昆明</em>交运经贸有限公司",
"estiblishTime": "1981-12-25 00:00:00.0",
"type": 1
},
{
"regCapital": "20879.42万人民币",
"companyType": 1,
"name": "昆明盛世桃源实业有限公司",
"base": "云南",
"legalPersonName": "黄晶",
"id": 567014090,
"htmlName": "<em>昆明</em>盛世桃源实业有限公司",
"estiblishTime": "1988-05-12 00:00:00.0",
"type": 1
},
{
"regCapital": "1300万人民币",
"companyType": 1,
"name": "昆明饮食服务有限公司",
"base": "云南",
"legalPersonName": "娄建光",
"id": 274111229,
"htmlName": "<em>昆明</em>饮食服务有限公司",
"estiblishTime": "2002-01-24 00:00:00.0",
"type": 1
},
{
"regCapital": "205223.3万人民币",
"companyType": 1,
"name": "昆明自来水集团有限公司",
"base": "云南",
"legalPersonName": "施伟",
"id": 553856447,
"htmlName": "<em>昆明</em>自来水集团有限公司",
"estiblishTime": "1983-04-19 00:00:00.0",
"type": 1
},
{
"regCapital": "200万人民币",
"companyType": 1,
"name": "昆明中北国际旅行社有限公司",
"base": "云南",
"legalPersonName": "李伟民",
"id": 365375711,
"htmlName": "<em>昆明</em>中北国际旅行社有限公司",
"estiblishTime": "1996-06-28 00:00:00.0",
"type": 1
},
{
"regCapital": "3000万人民币",
"companyType": 1,
"name": "恒大地产集团昆明有限公司",
"base": "云南",
"legalPersonName": "熊敏",
"id": 341395509,
"htmlName": "恒大地产集团<em>昆明</em>有限公司",
"estiblishTime": "2010-07-20 00:00:00.0",
"type": 1
},
{
"regCapital": "-",
"companyType": 1,
"name": "昆明市粮食局",
"base": "",
"legalPersonName": "",
"id": 1290744247,
"htmlName": "<em>昆明</em>市粮食局",
"estiblishTime": "-",
"type": 1
},
{
"regCapital": "1100万人民币",
"companyType": 1,
"name": "昆明亚龙冶金有限责任公司",
"base": "云南",
"legalPersonName": "李晓霆",
"id": 208424072,
"htmlName": "<em>昆明</em>亚龙冶金有限责任公司",
"estiblishTime": "1985-11-12 00:00:00.0",
"type": 1
},
{
"regCapital": "1000万人民币",
"companyType": 1,
"name": "昆明星耀集团实业有限公司",
"base": "云南",
"legalPersonName": "颜进",
"id": 235290092,
"htmlName": "<em>昆明</em>星耀集团实业有限公司",
"estiblishTime": "1993-02-13 00:00:00.0",
"type": 1
}
],
"msgCode": 0,
"ret_code": 0
}
}
失败返回示例
{
"showapi_res_error": "",
"showapi_res_id": "82045339ca3a47828215041d856e131e",
"showapi_res_code": 0,
"showapi_res_body": {
"msg": "参数不符合,查询不到相应结果",
"msgCode": 1,
"ret_code": -1
}
}
返回码定义
返回码
|
返回信息
|
描述
|
---|---|---|
无参数
|
商品介绍
企业搜索返回如下:
企业基本信息返回如下:

使用指南
1购买完成后,点击进入控制台

2在控制台点击”管理“查看详情”

3获得API的SecretID和SecretKey后,即可按照商品介绍里的方式调用API

累计评价(0)
综合评分
-