Skip to content

Access keys for nzta.govt.nz

  • h Home
  • m Menu
  • 0 Show list of access keys
  • 2 Skip to content
  • 3 Skip to top

Traffic Cameras API

The Traffic Cameras API allows registered developers to access real-time static images in jpg format which refresh every 30 seconds and show over 100 key traffic locations across New Zealand.

Examples of the images available can be found here:

http://www.journeys.nzta.govt.nz/traffic-and-travel-information/traffic-cameras/ (external link)

The API data includes references to each traffic cameras physical location (via GPS), with descriptions of the cameras name and what view is being shown.

 Access

The camera API who’s address is

https://infoconnect1.highwayinfo.govt.nz:443/ic/jbi/TrafficCameras2/SOAP/FeedService/ 

https://infoconnect1.highwayinfo.govt.nz:443/ic/jbi/TrafficCameras2/REST/FeedService/

Provides a list of all the cameras seen in the 1st link and additional information about them, such at their coordinates or the current photo image captured from them.

Request

To get data from the API you create and POST HTTP requests in the below formats

Format

Request

REST

You POST an HTTP request with the headers

  • username - USERNAME
  • Password – PASSWORD

 

SOAP

You POST an HTTP request with the headers

  • username - USERNAME
  • Password – PASSWORD
  • Content-Type - text/xml

 

HTTP body should look like this

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cam="https://infoconnect.highwayinfo.govt.nz/schemas/camera2">

   <soapenv:Header>

      <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">

         <wsse:UsernameToken >

            <wsse:Username>USERNAME</wsse:Username>

            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">PASSWORD</wsse:Password>           

         </wsse:UsernameToken>

      </wsse:Security>

    </soapenv:Header>

   <soapenv:Body>

      <cam:getCamerasRequest/>

   </soapenv:Body>

</soapenv:Envelope>

It’s worth noting that the REST API does not return JSON, but rather, it returns XML without a SOAP envelope.

For testing purposes you can use Postman (external link) to communicate with the Cameras API

 

Response

Once you send a request to the API you should get back a response that looks like this.

Format

Response

REST

<?xml version='1.0' encoding='UTF-8'?>

<tns:getCamerasResponse xmlns:tns="https://infoconnect.highwayinfo.govt.nz/schemas/camera2">

    <tns:camera>

        <tns:description>North along Sth Wstn Mwy from May Rd</tns:description>

        <tns:direction>Northbound</tns:direction>

        <tns:group>NA</tns:group>

        <tns:id>653</tns:id>

        <tns:imageUrl>http://www.trafficnz.info/camera/653.jpg</tns:imageUrl>

        <tns:lat>-36.90943</tns:lat>

        <tns:lon>174.73442</tns:lon>

        <tns:name>SH20 May Rd Overbridge</tns:name>

        <tns:offline>false</tns:offline>

        <tns:region>Auckland</tns:region>

        <tns:thumbUrl>http://www.trafficnz.info/camera/thumb/653.jpg</tns:thumbUrl>

        <tns:underMaintenance>false</tns:underMaintenance>

        <tns:viewUrl>http://www.trafficnz.info/camera/view/653</tns:viewUrl>

    </tns:camera>

<tns:camera>… </tns:camera>        

<tns:camera>… </tns:camera>        

<tns:camera>…</tns:camera>        

 

SOAP

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

   <soapenv:Body>

      <tns:getCamerasResponse xmlns:tns="https://infoconnect.highwayinfo.govt.nz/schemas/camera2">

         <tns:camera>

            <tns:description>North along Sth Wstn Mwy from May Rd</tns:description>

            <tns:direction>Northbound</tns:direction>

            <tns:group>NA</tns:group>

            <tns:id>653</tns:id>

            <tns:imageUrl>http://www.trafficnz.info/camera/653.jpg</tns:imageUrl>

            <tns:lat>-36.90943</tns:lat>

            <tns:lon>174.73442</tns:lon>

            <tns:name>SH20 May Rd Overbridge</tns:name>

            <tns:offline>false</tns:offline>

            <tns:region>Auckland</tns:region>

            <tns:thumbUrl>http://www.trafficnz.info/camera/thumb/653.jpg</tns:thumbUrl>

            <tns:underMaintenance>false</tns:underMaintenance>

            <tns:viewUrl>http://www.trafficnz.info/camera/view/653</tns:viewUrl>

         </tns:camera>

<tns:camera>… </tns:camera>        

<tns:camera>… </tns:camera>        

<tns:camera>…</tns:camera>        

<tns:camera>…</tns:camera>        

 

 

As you may notice, you get an XML response whether you use SOAP or REST to access the API, the only difference with REST is that you do not need to supply a body and you will not receive the SOAP envelope in your response.

 

Data definition

To see how the response is structured, which will help you when you are coding something to process the XML response, you can find the WSDL (external link) file here.

https://infoconnect1.highwayinfo.govt.nz/ic/jbi/TrafficCameras2/SOAP/FeedService/main.wsdl

This describes the scope of what your application should be prepared to handle when it receives a response from this API

 

Known Issues

We are aware of a problem where a Camera may be in fault, and it will respond to a heartbeat check, but maintenance is still required and no traffic images are being produced.

In this case the Camera will show the generic “Unavailable” image (shown below), but the offline and underMaintenance fields in the return SOAP will both be false.

The only work around to this currently is to manually save the generic “Unavailable” image and manually check if the in-fault Camera’s retrieved image’s contents are equivalent to this image.

 

Webcam unavailable image

 

If you notice any additional issues or have suggestions for improvements please contact us at infoconnect@nzta.govt.nz

Top