Quick start guide

Once you have obtained your key and developer ID you can get started. The first thing you need to do is to calculate a signature.

How to calculate a signature

NOTE [Editor's addition]: "request" here is the URL from "/v2" onwards, and the signature must be converted to upper case.

For example, "http://timetableapi.ptv.vic.gov.au/v2/healthcheck?devid=ABCXYZ" and "http://timetableapi.ptv.vic.gov.au/v2/HealthCheck?devid=ABCXYZ" require different signatures to be calculated; the same signature will not work for both requests. * The signature itself is also case-sensitive

Example of a request message for signature calculation:

The request URL for the API is:

base URL/v2/nearme/latitude/%@/longitude/%@?devid=%@&signature=%@

A sample request message used to calculate a signature would be: http://timetableapi.ptv.vic.gov.au/v2/nearme/latitude/-37.82392124423254/longitude/144.9462017431463?devid=0000001

Refer to the Appendix for some sample code for calculating a signature.

Performing the Health Check

The first API you need to call is the Health Check. The Health Check will test a number of the key services that deliver the PTV Timetable API and let you know if there are any problems with connectivity, availability or reachability. It will also test the time on your system to make sure that your clock is in sync with our clock.

The output is in the JSON format.

Health Check request URL: http://timetableapi.ptv.vic.gov.au/v2/healthcheck?timestamp=%@&devid=%@&signature=%@

%@ in the request URL represents a parameter

Performing health check

Parameters
timestampoptional: the date and time of the request in ISO 8601 UTC format e.g. 2014-02-28T05:24:25Z
devidoptional: the developer ID supplied in your email from PTV
signatureoptional: the customised message digest calculated using the method in the Quick start guide

Response output:
{
  "securityTokenOK": boolean,
  "clientClockOK": boolean,
  "memcacheOK": boolean,
  "databaseOK": boolean,
}
where a "true" value indicates service connectivity and availability, and "false" indicates a problem. For more information on this API, check out Errors and the Reference.

Congratulations

Once you've calculated a signature and performed the health check successfully you are ready to access the timetable, line and stop data available through the PTV Timetable API. All systems are go!

supplescroll:lucid theme