Failed to set restrictions(before and after) in post tour API


#1

i input the following json:

[
{
“name”: “origin”,
“lat”: “22.417197722000”,
“lng”: “113.981741311300”,
“Address”: “rider current location”
},
{
“name”: “69”,
“lat”: 22.271909309,
“lng”: 113.934072606,
“Address”: “Tung Chung Station, Tung Chung, Hong Kong”
},
{
“name”: “73”,
“lat”: 22.38549872591,
“lng”: 113.98178102419,
“Address”: “Tsing Hung Rd, Tsing Yi, Hong Kong”
},
{
“name”: “70”,
“lat”: 22.400781143,
“lng”: 113.978117972,
“Address”: “Lam Kam Rd, Lam Tsuen, Hong Kong”,
“restrictions”: {
“before”: 1
}
},
{
“name”: “74”,
“lat”: 22.462834485,
“lng”: 113.991883069,
“Address”: “Tin Ying Rd, Lau Fau Shan, Hong Kong”,
“restrictions”: {
“before”: 2
}
}
]

however, the api outputs this:

stdClass Object
(
[id] => i0cd2z06
[count] => 5
[feasible] =>
[route] => stdClass Object
(
[0] => stdClass Object
(
[name] => origin
[arrival] => 0
[distance] => 0
)

        [1] => stdClass Object
            (
                [name] => 70
                [arrival] => 2
                [distance] => 2.1
            )

        [2] => stdClass Object
            (
                [name] => 73
                [arrival] => 5
                [distance] => 4.4
            )

        [3] => stdClass Object
            (
                [name] => 69
                [arrival] => 34
                [distance] => 38.6
            )

        [4] => stdClass Object
            (
                [name] => 74
                [arrival] => 67
                [distance] => 77.4
            )

    )

)

the location named 69 is not before the location named 70.
is there any problem in my input json? thanks!!!


#2

The behaviour is inverse to your expectation. To get location 70 after 69, set “after”: 1

Also, the last location 74 will always be the final destination by default. Setting restrictions for the last location will have no effect on that.


#3

thanks!!! i know how to do now.