???? API ??????
???????? API ? xkxdv ?????????????,???????:?????,?????????????????????????????????????????????????????????
???????????????????????????????????????????????????????????????????????? Excel ?????,??????????????,??????????????
??????:?? API Key
????????? xkxdv ??????,????????? API ???????????????? api_key ???,?????????????,???????????,?????????????
?? api_key ????????????? API ????????????,??????????,???????????????????
????????
| ?? | ?? | ?? | ?? |
|---|---|---|---|
| api_key | string | ? | ?? API ?? |
| keyword | string | ? | ???????,?? 2 ??? |
| action | string | ? | ?? search,??? company_search |
| page_num | int | ? | ??,?? 1 |
| page_size | int | ? | ????,?? 20,?? 50 |
?? keyword ???????:????????????????????????,???????????????????????????????????????????? 2 ???,????? 1002 ????
??????????(????)
xkxdv ???????????????,???????,???????:Header ??,??? JSON Body?POST Form,??? GET Query????????? JSON Body,?????,???????????????
???:HTTP Header ?? api_key
curl -X POST https://open.xkxdv.com/api/company_search_api.php \
-H "api_key: your_api_key" \
-H "Content-Type: application/json" \
-d '{"keyword":"??","page_num":1,"page_size":20}'
???:JSON Body
POST /api/company_search_api.php
Content-Type: application/json
{
"api_key": "your_api_key",
"keyword": "??",
"page_num": 1,
"page_size": 20
}
???:POST Form
api_key=your_api_key&keyword=??&page_num=1&page_size=20
???:GET Query(?????)
GET /api/company_search_api.php?api_key=your_api_key&keyword=??&page_num=1
?????????
PHP ??
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://open.xkxdv.com/api/company_search_api.php',
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'api_key' => 'your_api_key',
'keyword' => '??',
'page_num' => 1,
'page_size' => 20,
]),
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($curl);
curl_close($curl);
$result = json_decode($response, true);
if ($result['code'] === 0) {
foreach ($result['data']['data']['companyList'] as $company) {
echo $company['companyName'] . ' - ' . $company['creditNo'] . PHP_EOL;
}
}
Python ??
import requests
resp = requests.post(
'https://open.xkxdv.com/api/company_search_api.php',
json={
'api_key': 'your_api_key',
'keyword': '??',
'page_num': 1,
'page_size': 20,
},
timeout=15
)
data = resp.json()
if data['code'] == 0 and data['data']['success']:
for item in data['data']['data']['companyList']:
print(item['companyName'], item['legalPerson'], item['companyStatus'])
Node.js ??
const https = require('https');
const postData = JSON.stringify({
api_key: 'your_api_key',
keyword: '??',
page_num: 1,
page_size: 20,
});
const options = {
hostname: 'open.xkxdv.com',
path: '/api/company_search_api.php',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(postData),
},
};
const req = https.request(options, (res) => {
let body = '';
res.on('data', (chunk) => body += chunk);
res.on('end', () => console.log(JSON.parse(body)));
});
req.on('error', (e) => console.error(e));
req.write(postData);
req.end();
????????
????????????,??? xkxdv ??????,?? data ?????????????????????????:result.data.data.companyList?????????????:
companyName- ????creditNo- ????????(18 ?)legalPerson- ???????companyStatus- ????(???? / ?? / ?? / ??)establishDate- ????,?? yyyyMMdd
????? pageInfo ?,totalRecords ???????? totalRecords ??? pageSize,?????????????
????????????
| ??? | ?? | ???? |
|---|---|---|
| 0 | ?? | - |
| 1001 | ?????? | ?? api_key?keyword ????? |
| 1002 | ?????? | keyword ?? 2 ??? |
| 1003 | ???? | api_key ??????,??????? |
| 1004 | ???? | ??????,???????? |
| 1005 | ???? | ??????,???? |
| 5000 | ???? | ???????? |
??????????
????????????:??? api_key ???????????,????????;????????,???? 15 ?,???????????;????????????,????????????????????????,???????
????? page_size ?? 50 ?,???????????????????,???????? pageIndex ?? pageSize ???? totalRecords????????? yyyyMMdd ??????,??????????????????