curl -X POST 'https://openapi.jiawei.net/api/v1/global.basic' \
-H 'X-App-Key: ak_xxxxxxxxxxxx' \
-H 'X-App-Sign: <hmac_sha256(timestamp, app_secret)>' \
-H 'X-App-Timestamp: 1700000000' \
-H 'Content-Type: application/json' \
-d '{"company_name":"佳维网络科技有限公司"}'
<?php
$ch = curl_init('https://openapi.jiawei.net/api/v1/global.basic');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-App-Key: ak_xxxxxxxxxxxx',
'X-App-Sign: ' . hash_hmac('sha256', $timestamp, $appSecret),
'X-App-Timestamp: ' . $timestamp,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'company_name' => '佳维网络科技有限公司',
]),
]);
$response = curl_exec($ch);
echo $response;
import requests, hmac, hashlib, time
app_key = "ak_xxxxxxxxxxxx"
app_secret = "xxxxxxxxxxxxxxxxxxxx"
ts = str(int(time.time()))
sign = hmac.new(app_secret.encode(), ts.encode(), hashlib.sha256).hexdigest()
resp = requests.post(
"https://openapi.jiawei.net/api/v1/global.basic",
headers={
"X-App-Key": app_key,
"X-App-Sign": sign,
"X-App-Timestamp": ts,
"Content-Type": "application/json",
},
json={"company_name": "佳维网络科技有限公司"},
)
print(resp.json())
OkHttpClient client = new OkHttpClient();
RequestBody body = RequestBody.create(
"{\"company_name\":\"佳维网络科技有限公司\"}",
MediaType.parse("application/json")
);
Request request = new Request.Builder()
.url("https://openapi.jiawei.net/api/v1/global.basic")
.post(body)
.addHeader("X-App-Key", "ak_xxxxxxxxxxxx")
.addHeader("X-App-Sign", "<hmac_sha256(timestamp, app_secret)>")
.addHeader("X-App-Timestamp", "1700000000")
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());