接口地址
https://api.qixin.com/APIService/enterprise/getStatisticsByPoint
数据格式
JSON
请求方式
POST
请求示例
{"longitude": 116.460988, "latitude":40.006919, "radius": 5, "industry": "F0000", "regist_capi": "0_100", "status": "1" }
描述
根据坐标查询周边企业总数
javascript
let request = require('request');
let crypto = require('crypto');
let baseUrl = 'https://api.qixin.com/APIService/enterprise/getStatisticsByPoint';
let appkey = '正式appkey';
let secretKey = '正式secret_key';
let timeStamp = new Date().getTime();
const hash = crypto.createHash('md5');
let sign = hash.update(appkey + timeStamp + secretKey).digest('hex');
let bodyParams = {
longitude: 'longitude的值',
latitude: 'latitude的值',
radius: 'radius的值',
industry: 'industry的值',
regist_capi: 'regist_capi的值',
status: 'status的值'
}
var options = {
'method': 'POST',
'url': baseUrl,
'headers': {
'Content-Type': 'application/json',
'Connection': 'keep-alive',
'Auth-version': '2.0',
'appkey': appkey,
'timestamp': timeStamp,
'sign': sign
},
body: JSON.stringify(bodyParams)
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
java
import com.mashape.unirest.http.*;
import org.json.JSONObject;
import java.security.MessageDigest;
import java.util.Calendar;
import java.nio.charset.StandardCharsets;
public class main {
// 获取字符串的md5值
public static String getMD5Str(String str) {
byte[] digest;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(str.getBytes(StandardCharsets.UTF_8));
digest = md.digest();
StringBuilder sb = new StringBuilder();
for (byte b : digest) {
String s = String.format("%02x", b);
sb.append(s);
}
return sb.toString();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static void main(String[] args) throws Exception {
String baseUrl = "https://api.qixin.com/APIService/enterprise/getStatisticsByPoint";
String appkey = "正式appkey";
String secretKey = "正式secret_key";
Calendar calendar = Calendar.getInstance();
Long timestamp = calendar.getTime().getTime();
String sign = getMD5Str(appkey + timestamp + secretKey);
// 设置request body参数
JSONObject bodyParams = new JSONObject();
bodyParams.put("other_keys", "other_values");
Unirest.setTimeouts(0, 2000);
try {
// 发送post请求,得到响应
HttpResponse<String> response = Unirest.post(baseUrl)
.header("Auth-version", "2.0")
.header("appkey", appkey)
.header("timestamp", timestamp + "")
.header("sign", sign)
.header("Content-Type", "application/json")
.body(bodyParams.toString())
.asString();
System.out.println(response.getBody());
} catch (Exception e) {
e.printStackTrace();
}
}
}
csharp
using System;
using System.Net.Http;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;
using System.Text.Json;
namespace csharp
{
class Program
{
public static string GetMD5Str(string str)
{
MD5 md5 = MD5.Create();
byte[] buffer = Encoding.Default.GetBytes(str);
byte[] MD5Buffer = md5.ComputeHash(buffer);
//将字节数组转换成字符串
string strResult = "";
for (int i = 0; i < MD5Buffer.Length; i++)
{
strResult += MD5Buffer[i].ToString("x2");
}
return strResult;
}
static void Main(string[] args)
{
var baseUrl = "https://api.qixin.com/APIService/enterprise/getStatisticsByPoint";
var appkey = "正式appkey";
var secretKey = "正式secret_key";
TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
var timeStamp = Convert.ToInt64(ts.TotalMilliseconds).ToString(); // 当前utc时间戳
var sign = GetMD5Str(appkey + timeStamp + secretKey); // 请求签名
// 设置url参数
Dictionary<string, string> bodyParams = new Dictionary<string, string>();
bodyParams.Add("other_keys", "other_values");
// 发送POST请求
HttpClient httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Add("Auth-version", "2.0");
httpClient.DefaultRequestHeaders.Add("appkey", appkey);
httpClient.DefaultRequestHeaders.Add("timestamp", timeStamp);
httpClient.DefaultRequestHeaders.Add("sign", sign);
httpClient.DefaultRequestHeaders.Add("Connection", "keep-alive");
httpClient.DefaultRequestHeaders.Add("ContentType", "application/json");
HttpContent content = new StringContent(JsonSerializer.Serialize(bodyParams), Encoding.UTF8, "application/json");
var post = httpClient.PostAsync(baseUrl, content);
// 输出响应
Console.WriteLine(post.Result.Content.ReadAsStringAsync().Result);
}
}
}
python
# -*- coding:utf-8 -*-
import requests
import json
import time
import hashlib
def md5Encode(srcStr):
'''计算字符串的md5值'''
m = hashlib.md5()
m.update(srcStr.encode('utf-8'))
return m.hexdigest()
# 接口信息
baseUrl = 'https://api.qixin.com/APIService/enterprise/getStatisticsByPoint'
appkey = '正式appkey'
secretKey = '正式secret_key'
timeStamp = int(time.time()) * 1000
# 设置请求头
headers = {
'Auth-version': '2.0', # 指定接口验证版本
'appkey': appkey,
'timestamp': str(timeStamp),
'sign': md5Encode(appkey + str(timeStamp) + secretKey),
'Content-Type': 'application/json;charset=UTF-8',
'Connection': 'keep-alive'
}
# 请求参数
bodyParams = {
'longitude': 'longitude的值',
'latitude': 'latitude的值',
'radius': 'radius的值',
'industry': 'industry的值',
'regist_capi': 'regist_capi的值',
'status': 'status的值'
}
# 调用接口
response = requests.post(baseUrl, headers=headers, data=json.dumps(bodyParams))
# 处理响应数据
jsonContent = json.dumps(str(response.content, encoding='utf-8'))
rspResult = jsonContent.encode('utf-8').decode('unicode-escape')
print(rspResult)