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

**URL:** <https://support.routexl.com/t/failed-to-set-restrictions-before-and-after-in-post-tour-api/564>\
**Category:** API\
**Created:** [March 24, 2018, 3:18pm UTC](https://support.routexl.com/t/failed-to-set-restrictions-before-and-after-in-post-tour-api/564 "2018-03-24T15:18:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ivefypfd](https://support.routexl.com/letter_avatar_proxy/v4/letter/i/a6a055/32.png) [@ivefypfd](https://support.routexl.com/u/ivefypfd)\
**Post date:** [March 24, 2018, 3:18pm UTC](https://support.routexl.com/t/failed-to-set-restrictions-before-and-after-in-post-tour-api/564/1 "2018-03-24T15:18:06Z")

</div>

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!!!

---

<div class="post-metadata">

**Author:** ![RouteXL](https://support.routexl.com/user_avatar/support.routexl.com/routexl/32/347_2.png) [@RouteXL](https://support.routexl.com/u/RouteXL)\
**Post date:** [March 25, 2018, 5:30pm UTC](https://support.routexl.com/t/failed-to-set-restrictions-before-and-after-in-post-tour-api/564/2 "2018-03-25T17:30:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ivefypfd](https://support.routexl.com/letter_avatar_proxy/v4/letter/i/a6a055/32.png) [@ivefypfd](https://support.routexl.com/u/ivefypfd)\
**Post date:** [April 3, 2018, 5:42am UTC](https://support.routexl.com/t/failed-to-set-restrictions-before-and-after-in-post-tour-api/564/3 "2018-04-03T05:42:16Z")

</div>

thanks!!! i know how to do now.
