POST到/ requests导致半永久性409 current_trip_exists错误,GET显示no_current_trip

时间:2017-03-31 18:49:54

标签: uber-api

我们发布帖子请求时收到409 current_trip_exists错误。当我们向/ requests / current端点发出get请求时,它表示没有当前行程,当我们向/ requests / requestId端点发出get请求时,它表示上次行程已完成。下面的请求/响应演示了正在发生的事情。

沙箱中不会发生此行为。用户目前没有乘车。

重现步骤

以下步骤三次成功复制了错误行为。

  1. 用户完成乘车后,使用API​​在不同地区订购。例如,我们将在帕洛阿尔托完成旅行,然后在西雅图订购。
  2. 致电第二次行程的司机并要求他们取消乘车。
  3. 在第二个目的地重新排序。
  4. 从那时起大约24小时,用户在尝试订购游乐设施时会遇到current_trip_exists错误。它不会影响所有lat / long / productId,但我在本文末尾列出了lat / long / productId列表。

    我认为这可能会发生,因为优步有时会在第一个取消时找到第二个驱动程序。我们正在获取driver_canceled状态并立即触发新的POST请求,但Uber可能正在使用该帐户来查找新的驱动程序。我不确定,因为409错误会在很长一段时间内继续发生,并且它会在某些纬度/长度中起作用,但在其他情况下不起作用。

    当通过电话对帐户进行乘车时,它会清除错误。

    继续......

    POST请求/ v1 / requests

    curl --request POST \
    --url https://api.uber.com/v1/requests \
      --header 'authorization: Bearer xxxx' \
      --header 'cache-control: no-cache' \
      --header 'content-type: application/json' \
      --header 'postman-token: 5b663d39-3600-645c-27c3-339cbba4d239' \
      --data '{"product_id": "33de8094-3dc4-4ca9-8f67-243275f57623","start_latitude": 39.237713,"start_longitude": -94.43628029999999}'
    

    响应

    Connection: keep-alive
    Content-Geo-System: wgs-84
    Content-Length: 109
    Content-Type: application/json
    Date: Tue, 04 Apr 2017 20:16:19 GMT
    Server: nginx
    Strict-Transport-Security: max-age=604800
    X-Content-Type-Options: nosniff
    X-XSS-Protection: 1; mode=block 
    
        {
          "meta": {},
          "errors": [
            {
              "status": 409,
              "code": "current_trip_exists",
              "title": "The user is currently on a trip."
            }
          ]
        }
    

    但是当我发出GET请求来检查用户是否在旅途中时:

    GET请求v1 / requests / current

    curl --request GET \
      --url https://api.uber.com/v1/requests/current \
      --header 'authorization: Bearer xxxx' \
      --header 'cache-control: no-cache' \
      --header 'content-type: application/json' \
      --header 'postman-token: 3ba89d75-071c-a24f-ce5e-22d1671c4d4b'
    

    响应

    Connection →keep-alive
    Content-Encoding →gzip
    Content-Type →application/json
    Date →Wed, 05 Apr 2017 16:48:33 GMT
    Server →nginx
    Strict-Transport-Security →max-age=604800
    Transfer-Encoding →chunked
    X-Content-Type-Options →nosniff
    X-XSS-Protection →1; mode=block
    {
      "meta": {},
      "errors": [
        {
          "status": 404,
          "code": "no_current_trip",
          "title": "User is not currently on a trip."
        }
      ]
    }
    

    然后最后当我提出上次成功请求的请求时,此帐户有:

    GET请求v1 / requests / 906cff4d-5f05-4d46-9afd-1fdce67a0378

    curl --request GET \
      --url https://api.uber.com/v1/requests/906cff4d-5f05-4d46-9afd-1fdce67a0378 \
      --header 'authorization: Bearer xxxx' \
      --header 'cache-control: no-cache' \
      --header 'content-type: application/json' \
      --header 'postman-token: 3ba89d75-071c-a24f-ce5e-22d1671c4d4b'
    

    响应

    Connection →keep-alive
    Content-Encoding →gzip
    Content-Geo-System →wgs-84
    Content-Language →en
    Content-Type →application/json
    Date →Wed, 05 Apr 2017 16:54:18 GMT
    Server →nginx
    Strict-Transport-Security →max-age=604800
    Transfer-Encoding →chunked
    X-Content-Type-Options →nosniff
    X-Rate-Limit-Limit →2000
    X-Rate-Limit-Remaining →1958
    X-Rate-Limit-Reset →1491411600
    X-XSS-Protection →1; mode=block
    {
      "status": "completed",
      "product_id": "37a94557-682f-4562-ba62-2448f80d3ddd",
      "request_id": "906cff4d-5f05-4d46-9afd-1fdce67a0378",
      "driver": null,
      "eta": null,
      "location": {
        "latitude": 28.3581827,
        "bearing": null,
        "longitude": -82.1908453
      },
      "vehicle": null,
      "surge_multiplier": 1,
      "shared": false
    }
    

    v1.2也是如此,但获得前期票价的工作正常。

    触发current_trip_exists错误后,它只影响某些纬度/经度的产品。以下是一些不会发生错误的起始lat / long / productIds:

    34.708101,-92.409385,2143f90b-ce68-4f6d-a113-4872b207e626

    41.354571,-81.916012,49348f0a-c623-46c0-86eb-9c2f761e8de8

    33.5840017,-111.8866007,893cb2a1-c412-4fee-8947-dd2accbc56a1

    使用上述复制步骤触发错误后,许多不同位置都会出现错误。以下是一些不通过的起始lat / long / product_ids:

    41.2562659,-96.321596,807c3d2e-b97e-4f17-b43a-96cc0d0a1b9d

    41.1259355,-74.38201289,1b64bf82-a0ba-4b0f-be32-df8d05481d7e

    35.154967,-106.6907186,a07dd25b-37f2-4a13-b4a3-1b4b27d79a77

    28.947881,-81.298418,4d68a13c-a04b-478a-bc66-5369d0e9e23a

    32.24922,-110.825833,85bbf2e4-fdf0-476d-beb4-b69022994ed3

    37.896782,-122.044295,04a497f5-380d-47f2-bf1b-ad4cfdcb51f2

    37.36173,-122.0986,57c0ff4e-1493-4ef9-a4df-6b961525cf92

    34.0542439,-118.2658918,2143f90b-ce68-4f6d-a113-4872b207e626

    33.818729301,-84.812277183,6d898741-0175-4c71-ad5f-93fc66270d6a

    43.6746785,-79.3860744,d1e548ac-4be5-46c0-8c86-201ac8a36fc6

    39.9921432,-83.06592479,5ba3ede5-e093-40d4-9ca0-fa189695a9d3

    30.4200452,-86.60652449,e72f2ebe-7cea-451d-bb43-b68aea182ebc

0 个答案:

没有答案