Applications Guide > Mobile Apps > Integrated App

 Integration into own mobile apps


 Orientation Graphic: Click on the image to enlarge. The current component is highlighted in red.

Graphic Interface Integrated App

 Overview

If you are developing your own app, e.g. a Telematics app you can use the PTV Drive&Arrive API to develop your own Telematics App and to deliver position to PTV Drive&Arrive.

These are your benefits:

 How to

 Basic

What you mandatorily need to integrate PTV Drive&Arrive:

Create your own tour

You can create a tour with /tour/ POST.
  /tour POST - Create a tour (relevant to billing)

Tours can consist of several stops, including time slots, stop times, information on break & rest times or vehicle type.
By creating a tour, you receive a SCEMID for the tour and for each stop. SCEMIDs are reference IDs to use in following up API calls.

Use an already existing tour

Tours can also be created by your partner (e.g. using PTV Route Optimiser ST) or by your host system.
With the SCEMID of the stops of such an existing tour, you can inform Drive&Arrive about the position of a vehicle driving to them.
PTV Drive&Arrive can then calculate ETAs. With /tour/batch GET you have access to the tour attributes.
  /tour/batch/ GET - read multiple tours which belongs to the specified SCEM-IDs

Sending positions for a tour

To calculate ETAs for stops, you have to send vehicle positions of your vehicle to PTV Drive&Arrive with /event/ POST.
  /event/ POST - create an event for ..

Further information is also required while sending positions: e.g. the SCEMID of the stop you are driving to, GPS information (coordinates, heading, speed ...) or GPS quality and the information if you want PTV Drive&Arrive to record your trace.

 Advanced

The following functions are also often required:

Send positions after being offline

You should cache positions if they cannot be sent, and then send them with /event/batch POST.
  /event/batch POST - sending multiple events at once

Requesting ETA from Drive&Arrive

If you want to use the calculated ETA in your app, you can ask PTV Drive&Arrive for the ETAs with one call (from list of stops), using /stop/batch/eta POST.
  Stop

 Professional

Create tours to locations

To display an Arrival Board, tours to these locations are needed. Also positions to calculate ETA.
So, if you only know the address or coordinates of the target, you can search for locations around the address with /location/proximity GET.
  /location/proximity/ GET - get locations in proximity of a coordinate

You will get a list of known locations around to select from. Then you can create a tour with /location/tour POST.
  /location/tour POST - create a single stop tour

This is free of charge for you, as it is included in the pricing of the Arrival Board itself.

Subscribe to ETA

If you like to receive the ETA result of every route calculation performed, you can subscribe to it – for specific stops – using /subscription/ POST.

  Subscriptions

There are two types for being informed via HTTP-callback or via SSE (notifier): you’ll find them in the examples.

Ask for ETA of an Arrival Board location

If you want to know the arrivals for a specific  PTV Arrival Board (all ETAs for the incoming vehicles) you can use /location/arrivals/{ID}/ GET.
  /location/arrivals/{ID}/ GET - get stop and ETA information for location

 Expert

There are many possibilities for further improvements:

Improve your GPS with location services

In iOS and Android there are available device specific location services, that provide an improved position – not only using GPS, but also other services like AGPS or Wifi – and provide an improved combined position.

Send positions only, if you have started driving

If you are sending positions while the vehicle didn’t start driving, you must expect the ETA to be delayed until you start driving. The desired state is, that the ETA is not displayed while you are not driving, and in case the ETA is displayed, it is hopefully stable.

Tour Updates

If your tour changes between – e.g because you would like to add an additional stop or change the PTA (planned time of arrival) – you can update tours with /tour/ PUT (if you have the relevant rights to do so).
  /tour/batch/ PUT - update multiple tours which belong to the specified SCEM-IDs

 

 

© 2022 PTV Planung Transport Verkehr GmbH | Imprint

Get in Contact