Authenticating Travel Time Data Service


#1

I’m trying to authenticate for the TTDS API… however, the documentation is a bit ambigious as to how we should pass our credentials to the server.

I’ve tried the two default methods in the API explorer (using API key auth via the header and as a parameter) but no luck there:

$ curl --user "apikey:l7xx..." --header "Content-Type:application/vnd.ttds-route+json"  --header "X-User-Agent:TestApp/1.0"  --header "Content-Type:application/vnd.ttds-route+json" --data '{"encoded-paths": ["jsumEge|y[t@FpId@`@BToCtAHrAJ~@GXBt@DN@JLvBLxE\zCVbEVpFZjCR\AjAD\BHHf@Dn@DfCP|@BEr@GhAEn@Oh@[rCt@PjEx@lCb@n@JdAP"],"departure-time": 1695168000}' --request POST 'https://api.transport.nsw.gov.au/v1/ttds/route'
{ "ErrorDetails":{ "TransactionId":"00000155461f9315-...", "ErrorDateTime":"2016-11-05T23:00:45.777+11:00", "Message":"The calling application is unauthenticated.", "RequestedUrl":"/v1/ttds/route", "RequestMethod":"POST" } }


$ curl --header "Content-Type:application/vnd.ttds-route+json"  --header "X-User-Agent:TestApp/1.0"  --header "Content-Type:application/vnd.ttds-route+json" --data '{"encoded-paths": ["jsumEge|y[t@FpId@`@BToCtAHrAJ~@GXBt@DN@JLvBLxE\zCVbEVpFZjCR\AjAD\BHHf@Dn@DfCP|@BEr@GhAEn@Oh@[rCt@PjEx@lCb@n@JdAP"],"departure-time": 1695168000}' --request POST 'https://api.transport.nsw.gov.au/v1/ttds/route?apikey=l7xx...'
{ "ErrorDetails":{ "TransactionId":"00000155461f9315-...", "ErrorDateTime":"2016-11-05T23:01:24.809+11:00", "Message":"The calling application is unauthenticated.", "RequestedUrl":"/v1/ttds/route", "RequestMethod":"POST" } }

Would love to get some guidance :slight_smile:


#2

doh! all good! I forgot the API doesn’t use Basic authentication.

$ curl --header "Authorization: apikey l7xx...