如何调用接口
- 同步服务器时间 ntp1.aliyun.com , ntp2.aliyun.com .. ntp7.aliyun.com
- 所有接口统一采用 https post 方式调用
0x01 接口请求地址
https://api.yopoint.com/api/gateway/index
0x02 请求方式
Method: POST
Content-Type: application/x-www-form-urlencoded
或者
Content-Type: application/json
0x03 公共请求参数
参数名称 | 类型 | 是否必须 | 描述 | 示例值 |
---|---|---|---|---|
appid | string | Y | 运营商后台创建的 AppID | 930859529955 |
method | string | Y | 接口名称 (字母小写) | activity.voucher.exchange |
biz_content | string | Y | 业务参数 json 字符串 | |
version | string | Y | 接口版本:1.0.0,目前固定此版本 | 1.0.0 |
timestamp | int | Y | unix 时间戳到秒 | 1556943285 |
sign_type | string | Y | 签名方式,md5 (小写) | md5 |
sign | string | Y | 签名(小写) | 签名方式见下文 |
0x04 返回结果结构
参数名称 | 类型 | 是否必须 | 说明 | 示例值 |
---|---|---|---|---|
error_code | int | 是 | 错误代码 =0 正常(操作成功,接口调用成功) !=0 异常错误 | 0 |
error_msg | string | 是 | 错误描述 | ERR_SYSTEM |
data | object | 是 | 返回业务内容 | {} |
0x05 签名
- 除 sign 参数外所有参数必须参与签名,参数以文本方式字典排序,排序后使用 key=value&key=value 方式拼接字符串
- 得到字符串 tmpString
- 签名:md5(tmpString+"&"+appSecret) 得出的结果转换为小写字母
- appSecret 在运营商后台获得
示例
appid = 930859529955
appSecret = xxxxxx
//待签名字符串
appid=930859529955&biz_content={"ReceiptNo":"OD190425164650841431"}&method=consumer.order.get&sign_type=md5×tamp=1556943545748&version=1.0.0&xxxxxx
// md5以上字符串
sign=b156660e474668f63876c799870acdf8