Table access via services |
The logical tables exist to give you a common way to view and access your Verizon Connect data. You can access the data using the API type that works best for your situation:
This topic contains the following sections:
For example, there is one Job table, but there are different ways to work with it, because there are three API services available for accessing it. Compare the following techniques for retrieving jobs.
One way to retrieve the jobs is by writing and running Templates.
The Intent = Retrieve lets you request data, which defaults to CSV format.
The [Filter] section limits the data to the time frame you want.
Authentication is passed as an authentication token on the query string.
[Template] TemplateVersion = 1.0 TableID = Job-1.0 TemplateName = JobStatusRetrieve Intent = Retrieve OrderBy = Input.ExpectedArrivalTime [Output] Tag = Input.Tag JobStatus = Input.JobStatus ActualArrival(s) = Input.ActualArrivalTime ActualDeparture(s) = Input.ActualDepartureTime ActualTravelDistance(km) = Input.ActualTravelDistance [Filter] ExpectedArrivalTime = Between("2013-07-01", "2013-07-02")
Another way to retrieve the jobs is by making calls via the REST API.
Note |
---|
The REST API supports the Verizon Connect Mobile applications, so its calls filter on the current driver. A driver must be assigned to the user authenticated for the call, and only jobs for that driver are returned. |
GET /jobs?from=2013-07-01&to=2013-07-02
The response body that you get back contains a JSON array of the job objects that you requested.
To access the Job table using the SOAP interface, you handle authentication within the application itself. This simple console application creates a CSV data file that lists jobs:
Fleet.LegacyTelogisServiceClient service; Fleet.AuthenticationHeader header; Fleet.Job[] jobs; Fleet.TelogisServiceClient tsclient = new Fleet.TelogisServiceClient(); string authToken = tsclient.Login("Acme:main", "password"); service = new Fleet.LegacyTelogisServiceClient(); header = new Fleet.AuthenticationHeader(); header.SessionID = authToken; DateTime date1 = DateTime.Now.AddDays(-7); DateTime date2 = DateTime.Now.AddDays(7); Fleet.Unit unit = new Fleet.Unit { ID = 135603702 }; jobs = service.GetJobsForUnit(header, unit, date1, date2); using (FileStream fs = new FileStream("Jobs.csv", FileMode.OpenOrCreate)) { using (StreamWriter w = new StreamWriter(fs)) { // Line for the column headers: w.Write("ID,ExpectedArrivalTime,Notes"); // Line for each job: foreach (Fleet.Job j in jobs) { w.Write("\n\"" + j.Id + "\",\"" + j.ExpectedArrivalTime + "\",\"" + j.Notes + "\""); } } }
The Driver table, like the other TDE tables, is reachable in different ways. You can access the table using the SOAP API web service in your own application. This example creates a CSV data file with current drivers:
Fleet.LegacyTelogisServiceClient service; Fleet.AuthenticationHeader header; Fleet.Driver[] drivers; Fleet.TelogisServiceClient tsclient = new Fleet.TelogisServiceClient(); string authToken = tsclient.Login("Acme:main", "password"); service = new Fleet.LegacyTelogisServiceClient(); header = new Fleet.AuthenticationHeader(); header.SessionID = authToken; drivers = service.ListDrivers(header, 0, 128); using (FileStream fs = new FileStream("Current_Drivers.csv", FileMode.OpenOrCreate)) { using (StreamWriter w = new StreamWriter(fs)) { // Line for the column headers: w.Write("Name,ID"); // Line for each driver: foreach (Fleet.Driver d in drivers) { w.Write("\n\"" + d.Name + "\",\"" + d.ID + "\""); } } }
Here is the equivalent TDE template:
[Template] TemplateVersion = 1.0 TableID = Driver-1.0 TemplateName = ReadDrivers Intent = Retrieve [Output] Name = Input.Nickname ID = Input.Id