调用方法详解
1.货拉拉API调用
货拉拉开放平台是基于HTTP协议调用的,开发者(ISV)可以需封装为HTTP请求来进行调用。接下来会针对自行封装的HTTP请求进行API调用过程进行详细说明。
开发者需要按照协议规范拼装一个正确的URL,通过Https请求到货拉拉开放平台获取到所需数据。主要流程包含:填写参数、生成签名、拼装HTTPS请求、发起请求、得到响应结果、解析结果。
3.调用入口
沙箱环境服务入口: https://openapi-stg.huolala.cn/v1
生产环境服务入口: https://openapi.huolala.cn/v1
4.调用参数:
参数可区分为“系统级参数”和“业务参数”
5.签名说明:
调用API时需要对请求参数进行签名,货拉拉网关服务器端会验证请求参数是否正确。
签名算法请参照“签名算法”。
6.请求示例:
需授权接口调用示例。
https://openapi.huolala.cn/v1?api_data={
"city_id":1002,
"order_vehicle_id":402,
"vehicle_std":["双排座"],
"spec_req":[2,5],
"city_info_revision":296,
"order_time":1568895707,
"addr_info":[{
"name":"维也纳国际酒店(深圳北站店)",
"addr":"深圳市⻰华区致远中路2号",
"city_id":1002,
"city_name":"深圳",
"district_name":"宝安区",
"house_number":"20层2003号房",
"contacts_name":"刘⽣",
"contacts_phone_no":"136999969966",
"lat_lon":{
"lon":114.02309914676592,
"lat":22.609618527821251
}
},
{
"name":"⻓城开发⾼层公寓",
"addr":"皇岗路5000号",
"city_id":1002,
"city_name":"深圳",
"district_name":"福⽥区",
"house_number":"",
"contacts_name":"",
"contacts_phone_no":"",
"lat_lon":{
"lon":114.06548381551384,
"lat":22.569156830453188
}
}]
}&access_token=xxxxxxxxxxx&app_key=xxxxxxx&api_method=xxxxxxx×tamp=xxxxxxx&api_version=2.0&nonce_str=xxxxxxx&signature=xxxxxx
不需要授权接口调用示例。
https://openapi.huolala.cn/v1?api_data={
"city_id":1002,
"order_vehicle_id":402,
"vehicle_std":["双排座"],
"spec_req":[2,5],
"city_info_revision":296,
"order_time":1568895707,
"addr_info":[{
"name":"维也纳国际酒店(深圳北站店)",
"addr":"深圳市⻰华区致远中路2号",
"city_id":1002,
"city_name":"深圳",
"district_name":"宝安区",
"house_number":"20层2003号房",
"contacts_name":"刘⽣",
"contacts_phone_no":"136999969966",
"lat_lon":{
"lon":114.02309914676592,
"lat":22.609618527821251
}
},
{
"name":"⻓城开发⾼层公寓",
"addr":"皇岗路5000号",
"city_id":1002,
"city_name":"深圳",
"district_name":"福⽥区",
"house_number":"",
"contacts_name":"",
"contacts_phone_no":"",
"lat_lon":{
"lon":114.06548381551384,
"lat":22.569156830453188
}
}] }&app_key=xxxxxxx&api_method=xxxxxxx×tamp=xxxxxxx&api_version=2.0&nonce_str=xxxxxxx&signature=xxxxxx