1.登录
URL:https://v3.youbanghelper.com/api/auth
method:POST
data:{username:name,password:password}
return :200: {
token_type: "bearer",
access_token: "977ca0dddd29046769a0a41d0106cafef2d46a5d",
expires_in: 3600
}
401/400:{code: 400, error: "invalid_grant", error_description: "User credentials are invalid"}
2.检测登录状态
URL:https://v3.youbanghelper.com/api/auth
method:GET
return:{"status":0,"msg":"ok","data":{"companyInfo":{"name":"温江锦秀城","id":"597ef91d223bdd24ab040c4a"},"username":"春香","_id":"5982e4f9060e872da6385283","phone":"18508210931"}}
3.获取网点信息
URL:https://server3.youbanghelper.com/api/site/{siteId} // companyInfo.id;
method:GET
return {"status":0,"msg":"ok","data":{"_id":"597ef91d223bdd24ab040c4a","name":"温江锦秀城","address":"锦秀城1幢与2幢之间友帮管家","phone":"17318687052","desc":"温江锦秀城","location":"103.856646,30.682203","master":"赵蓉","status":"正在营业","pid":"597c7afae624113928b67ba7","ctime":"2017-07-31","__v":0,"smshasshelf":false,"sms":{"signname":"优邦管家"},"tc":"21:00","to":"09:00","type":1,"shelf":["A","生鲜","大件"],"slug":"site"}}
有用的信息是shelf:货架设置
4.获取快递单位
URL:https://server3.youbanghelper.com/api/partner?type=partner
method:GET
return {"status":0,"msg":"ok","data":{"total":25,"limit":200,"page":1,"data":[{"_id":"59c22d8874e2e2057be3d4f1","username":"韵达杨国庆","expresscompany":"韵达","phone":"13699040467","price":"0.3","desc":"","ctime":"2017-09-20”]}}
5.派件入库
URL:https://server3.youbanghelper.com/api/packages
method:POST
data:{
code:"654324565432345", //快递单号
expresscompany:"韵达",//快递公司名称
partner:"59c22d8874e2e2057be3d4f1",//快递单位id
partnername:"韵达杨国庆",//快递单位名称
phone:"17002818900",//收件人电话
shelf:0,// 货架索引
smsSend:true,//是否发送短信
status:0,//状态 0 入库 1 出库 9 异常
}
6.获取电话提示(输入的号码长度大于4的时候才触发,提高匹配效率)
URL:https://server3.youbanghelper.com/api/custom/phonetips?phone={phone}
methoed:GET
return {"status":0,"msg":"ok","data":{"_id":"59fd9971788c3f082a054692","phone":"17002818900"}}
7.出库
URL:https://server3.youbanghelper.com/api/packages/chuku
data:{code: "7654567876543456765" // 单号, id: "5a01656fa87bd339e9c67b3c"//文档id} // 派件详情里面出库
data:{code:"072"} // 取件码出库 取件码长度小于5
data:{code:"7654567876543456765"} // 单号出库
methoed:PUT
return {"status":0,"msg":"ok","data":{"ok":1,"nModified":1,"n":1,"opTime":{"ts":"6485672900706697217","t":4},"electionId":"7fffffff0000000000000004"}}
n > 1 出库成功
n = 0 出库失败,这个包裹没有入库
8.包裹列表 https://api.youbanghelper.com/api/packages?code=&phone=&status=&partner=&secret=&star=&end=&page=2&pageSize=20
code:单号支持模糊
phone:手机后四位
partner:快递单位id
secret:取件码
page:分页
pageSize:每页条数
各个参数可自由组合
{"status":0,"msg":"ok","data":{"total":520 // 共计,"limit":20 // 每页条数,"page":2 //分页 ,
"data[{"_id":"59f7f1d2c5c74f049435374c","code":"456876543234567654321","partner":"59f2fa35aeef4d2dca14e2dc","partnername":"申通丽丽","phone":"17002818900","status":1,"intime":"2017-10-31 11:45:22","serial":"31-1","smsstatus":"设置为不发送","desc":"无","shelf":"0","outtime":"2017-10-31 12:37:44"}]}}