API调用-积分查询

一、请求信息

      请求URL:https://www.shiliuai.com/api/id_photo/v1/credit

      请求方式:POST

      请求参数-请求头(Header):

参数 类型 说明
Content-type string application/json
APIKEY string 您的API KEY

二、返回信息

参数 说明
code 错误码
msg 错误信息(英文)
msg_cn 错误信息(中文)
credit 剩余API积分,(当code==0时有该返回值)

      错误信息:

错误码 说明
0 成功
101 API-KEY不正确

三、示例代码

Python 代码示例:

import requests
import json

api_key = '******'  # 你的API KEY

url = 'https://www.shiliuai.com/api/id_photo/v1/credit'
headers = {'APIKEY': api_key, "Content-type": "application/json"}

response = requests.post(url=url, headers=headers)
response = json.loads(response.content)
"""
成功:{'code': 0, 'credit': credit, 'msg': 'OK'}
or
失败:{'code': error_code, 'msg': error_msg}
"""
                            

PHP 代码示例:

$url = "https://www.shiliuai.com/api/id_photo/v1/credit";
$method = "POST";
$apikey = "******";
$header = array();
array_push($header, "APIKEY:" . $apikey);
array_push($header, "Content-Type:application/json");

$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);

$response = curl_exec($curl);
var_dump($response);