联盟成员注册后才能使用,注册成功后,每个联盟成员有一个身份ID和一个KEY,调用接口时必须传入身份ID(参数名为:union_id)和用数据签名。
**sign生成方法**:对请求数据按参数ASCII码排序,参数值为空的要去掉,中间用&连接,首尾不能有&,然后加上key=分配给成员的KEY,进行MD5并转为大写。
示例:上传车场信息
原始请求为:
> {union_id=10001, phone=13899884433, park_id=1001, address=北京上地三街9号, name=北京上地三街9号院停车场,city_id=110000,price_desc=每小时1元,empty_plot=56,lng=123.994449, rand=0.210354312785198048,total_plot=90,lat=32.466666}
#### **签名方法**:
按ASCII码排序连接后:
>address=北京上地三街9号&empty_plot=56&lat=32.466666&lng=123.994449&name=北京上地三街9号院停车场&city_id=110000&price_desc=2元每小时&park_id=1001&phone=13899884433&rand=0.210354312785198048&total_plot=90&union_id=10001
在后面加上:key=NQ0eSXs720170114 得到(NQ0eSXs720170114为分配给联盟成员的KEY):
address=北京上地三街9号&empty_plot=56&lat=32.466666&lng=123.994449&name=北京上地三街9号院停车场&city_id=110000&price_desc=2元每小时&park_id=1001&phone=13899884433&rand=0.210354312785198048&total_plot=90&union_id=10001key=NQ0eSXs720170114对上面的字符串MD5并大写得到:406950B85FB2C9421EA33D0E8ADD2483,
请求数据为:
> {"park_id":"1001","name":"北京上地三街9号院停车场","address":"北京上地三街9号","phone":"139000334443","lng":"123.994449","city_id":110000,"lat":"332.466666","total_plot":90,"empty_plot":56,"union_id":"10001","price_desc":"2元每小时",
"rand":"0.210354312785198048","sign":"406950B85FB2C9421EA33D0E8ADD2483"}
返回结果:
> {"park_id":"1001","state":1}