Home
wangxiao このページを編集 3 年 前

全局规则 (General Rules)

API Address: https://yyjobs-api-dev.guabean.com/swagger

接口文档地址:https://yyjobs-api-dev.guabean.com/swagger

  1. All the API must have the header Accept:application/x.yyjobs-api.v1+json

所有接口都必须增加header Accept:application/x.yyjobs-api.v1+json

  1. All API needs Authorization header must use Bearer xxxxxx.

所有需要Authorization header 的接口值必须为 Bearer xxxxxx

发布订单步骤 (How to Use the API)

1、Get the Token (获取token)

Use the API POST /api/third-part/auth/login Input email address to get the token. (The token expires after 24 hours)

使用/api/third-part/auth/login接口填写邮箱密码获取token (token 有效期24小时)

params:
field require type description
email true string
password true string

2、Send Order Info 发布订单信息

Use the API POST /api/third-part/order to send order info to YY.

使用/api/third-part/order发布订单

params:
field require type description
order_number true string Third-party platform order number.unique
zip_code true string
address true string Customer details address
lng true string
lat true string
reservation_delivery_time false string If this parameter is empty, it means calling the rider for delivery immediately.
amount false float If this parameter is empty or is 0, it means that the order is paid online.
success response
{
  "status": "success",
  "data": {
    "id": "202106041429495",
    "order_number": "KFC2015764",
    "zip_code": "409051",
    "lng": "103.819836",
    "lat": "1.352083",
    "address": "Marina Bay Sands Singapore",
    "amount": 0,
    "reservation_delivery_time": "",
    "estimate_assign_rider_seconds":3000,
    "created_at": "2021-06-04 14:32:08"
  },
  "code": 200,
  "message": "order post successful"
}

Order Staus API (获取订单状态)

Use the API GET /api/third-part/order/{id} to get the order status.

params:
field require type description
id true string YY platform order id
success response
{
  "status": "success",
  "data": {
    "id": "202106041429495",
    "order_status": 1,
    "deliver_status": 3,
    "message":"The rider has arrived at the store.",
    "time": "2021-06-04 14:45:22",
    "eta": "2021-06-04 15:08:00",
    "eta_to_store": "",
    "eta_to_customer": "",
    "rider":{
        "lng": "103.819836",
        "lat": "1.352083",
    }
  },
  "code": 200,
  "message": "get order successful"
}

order_status 1:Active (进行中订单) 2:Cancelled (已取消的订单) 3:Finished (完成的订单)

deliver_status 1:Pending Assigned (待匹配骑手) 2:Rider Assigned (已匹配骑手,等待抵达商家) 3:Arrived at outlet (已经抵达商家,待取货) 4:Food Picked Up (已取货,待送达) 5:Arrived at Customer's Place (已到达客户地址,待确认) 6:Order Delivered (已确认) 7:Order Completed (骑手已收款完成订单)

Rider List API (正在接单的骑手列表)

Use the API GET /api/rider

success response
{
  "status": "success",
  "data": [
    {
      "id": 222,
      "full_name": "Muhammad taufiq bin Mohamed sukaimi",
      "gender": "Male",
      "phone": "+65 90583321",
      "lng": "103.9081550118",
      "lat": "1.324636844975"
    },
    {
      "id": 1029,
      "full_name": "Muhammad bin Zakeri",
      "gender": "Male",
      "phone": "+65 87485407",
      "lng": "103.8613982066",
      "lat": "1.3268864989329"
    },
    {
      "id": 1158,
      "full_name": "MOHD SADRUDDIN BINAZMAN",
      "gender": "Male",
      "phone": "+65 87541085",
      "lng": "103.83256667085",
      "lat": "1.3554653744305"
    }
  ],
  "code": 200,
  "message": "success"
}

Assign Rider API (将订单分配给骑手)

Use the API POST /api/rider/{rider_id}/assign/{order_id}

success response
{
  "status": "success",
  "data": true,
  "code": 200,
  "message": "assigning..."
}