API调用案例
<h3>Postman测试</h3>
<p><img src="https://www.showdoc.cc/server/api/common/visitfile/sign/9069003dcf02915a1a443d6c36474c14?showdoc=.jpg" alt="Postman调试" title="Postman调试" /></p>
<h3>PHP(with curl):</h3>
<pre><code class="language-PHP">$code = "rb";
$date = "2018-08-08";
$url = sprintf('https://api.qhkch.com/warehouse_receipt/%s/%s', $code, $date);
$headers = [
'X-Token: 在此处输入奇货可查的 token,请联系奇货可查管理员获取'
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$res = curl_exec($ch);
curl_close($ch);
var_dump($res);</code></pre>
<h3>Python3(with requests):</h3>
<pre><code class="language-python">import requests
code = "rb"
date = "2018-08-08"
url = f'https://api.qhkch.com/warehouse_receipt/{code}/{date}'
headers = {'X-Token': '在此处输入奇货可查的 token,请联系奇货可查管理员获取'}
r = requests.get(url, headers=headers)
data_json = r.json()
print(data_json)</code></pre>