# Roads-Realtime Request Body

**URL:** <https://opendataforum.transport.nsw.gov.au/t/roads-realtime-request-body/295>\
**Category:** Uncategorized\
**Created:** [September 6, 2016, 1:54pm UTC](https://opendataforum.transport.nsw.gov.au/t/roads-realtime-request-body/295 "2016-09-06T13:54:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dave\_eire](https://avatars.discourse-cdn.com/v4/letter/d/f475e1/32.png) [@dave\_eire](https://opendataforum.transport.nsw.gov.au/u/dave_eire)\
**Post date:** [September 6, 2016, 1:54pm UTC](https://opendataforum.transport.nsw.gov.au/t/roads-realtime-request-body/295/1 "2016-09-06T13:54:52Z")

</div>

Hi,  
I have been looking at the Roads-Realtime Api both through the API Explorer and a Python script but cannot seem to get it to work. I know my API key and authorization is working as it works with [https://api.transport.nsw.gov.au/v1/ttds/events](https://api.transport.nsw.gov.au/v1/ttds/events) but i cannot get it to work with [https://api.transport.nsw.gov.au/v1/ttds/route](https://api.transport.nsw.gov.au/v1/ttds/route).

I followed the instructions as per the example in API Explorer and have set the X-User-Agent and Content-Type correctly and set the body to

“encoded-paths”: [“jsumEge|y[t@FpId@`@BToCtAHrAJ~@GXBt@DN@JLvBLxE\zCVbEVpFZjCR\AjAD\BHHf@Dn@DfCP|@BEr@GhAEn@Oh@[rCt@PjEx@lCb@n@JdAP”]

as per the example (omiting the departure-time as it is not required) but I keep getting a 400 Bad Request.

Has anybody any ideas on what i need to populate the Body with to get the route information.

---

<div class="post-metadata">

**Author:** ![phiali](https://sea1.discourse-cdn.com/flex019/user_avatar/opendataforum.transport.nsw.gov.au/phiali/32/221_2.png) [@phiali](https://opendataforum.transport.nsw.gov.au/u/phiali)\
**Post date:** [September 6, 2016, 10:24pm UTC](https://opendataforum.transport.nsw.gov.au/t/roads-realtime-request-body/295/2 "2016-09-06T22:24:35Z")

</div>

Have you also set an Accept header to “application/vnd.ttds-route+json” and a Content-Length header as well?

If that doesn’t work do you want to give this sample [https://alistairphillips.com/static/ttds.py](https://alistairphillips.com/static/ttds.py) a try and let me know how you get on.

---

<div class="post-metadata">

**Author:** ![dave\_eire](https://avatars.discourse-cdn.com/v4/letter/d/f475e1/32.png) [@dave\_eire](https://opendataforum.transport.nsw.gov.au/u/dave_eire)\
**Post date:** [September 7, 2016, 12:38pm UTC](https://opendataforum.transport.nsw.gov.au/t/roads-realtime-request-body/295/3 "2016-09-07T12:38:04Z")

</div>

hi mate,  
Many thanks for your python code. I managed to get my code to work by including the Accept and think I had the Body wrong too so thanks for that.  
Still trying to get the API Explorer to work with the update but it keeps going back to the dashboard.  
Happy enough to get it working in python though.

Thanks again

---

<div class="post-metadata">

**Author:** ![yvonne.lee](https://avatars.discourse-cdn.com/v4/letter/y/c37758/32.png) [@yvonne.lee](https://opendataforum.transport.nsw.gov.au/u/yvonne.lee)\
**Post date:** [September 8, 2016, 12:17am UTC](https://opendataforum.transport.nsw.gov.au/t/roads-realtime-request-body/295/4 "2016-09-08T00:17:32Z")

</div>

Sorry about the API Explorer bug… and has been raised with our vendor.

---

<div class="post-metadata">

**Author:** ![jayen](https://sea1.discourse-cdn.com/flex019/user_avatar/opendataforum.transport.nsw.gov.au/jayen/32/208_2.png) [@jayen](https://opendataforum.transport.nsw.gov.au/u/jayen)\
**Post date:** [September 9, 2016, 9:27am UTC](https://opendataforum.transport.nsw.gov.au/t/roads-realtime-request-body/295/5 "2016-09-09T09:27:20Z")

</div>

This works for me with the explorer:

![](https://us1.discourse-cdn.com/flex019/uploads/nsw/original/1X/8eeb9a0eed3d9677daed245c3001ad4f45907723.png)
