# Onfleet

Onfleet is a cloud-based fleet management solution that offers route optimization, auto-dispatching, delivery analytics and customer communications.

Onfleet integration replicates data using the [Onfleet REST API](https://docs.onfleet.com/reference/introduction).

See the [Schema](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Onfleet.htm#Schema) section for a list of objects available for replication.

## Preparing for authentication

To access your data, you need to authenticate the connection with your account credentials.

Information noteMake sure that the account you use has read access to the tables you want to fetch.

You must have administrative privileges to create a user in your Onfleet account.

To create an API key:

1. Log into your [Onfleet](https://onfleet.com/login) account.
2. Go to the API & Webhooks tab.
3. In the API Keys section, click +.
4. In the Name field, enter a name for the API key.
5. Click Create Key.
6. Copy and paste your API key into a secured file.

If you restrict an API key’s scopes, Qlik Talend Cloud can replicate only the scopes defined for that key.

## Creating the connection

For more information, see [Connecting to SaaS applications](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/Landing/connecting-web-applications.htm).

1. Fill in the required connection properties.

2. Provide a name for the connection in Connection name.

3. Select Open connection metadata to define metadata for the connection when it has been created.

4. Click Create.

Connection settings

| Setting | Description |
| --- | --- |
| Data gateway | Select a Data Movement gateway if required by your use case.<br><br>Information note<br><br>This field is not available with the Qlik Talend Cloud Starter subscription, as it does not support Data Movement gateway. If you have another subscription tier and do not want to use Data Movement gateway, select None.<br><br>For information on the benefits of Data Movement gateway and use cases that require it, see [Qlik Data Gateway - Data Movement](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Gateways/replication-gateway.htm). |
| Start Date | Enter the date, in the format `MM/DD/YYYY`, from which the data must be replicated from your source to your target. |
| API Key | API key. |
| Quota Limit | Enter the percentage of the Onfleet API quota that is allowed to use. For example, entering 10 would allow Qlik Talend Cloud to use 10% of the API quota. |

## Schema

Information note

Schemas and naming conventions can change from version to version. It is recommended to verify your version before continuing.

Depending on your destination, table and column names may not appear as they are outlined below.

### administrators

The `administrators` table contains info about the administrators in your Onfleet account.

| **Replication Method** | CDC |
| --- | --- |
| **Primary Key** | id |
| **Replication Key** | timeLastModified |
| **Useful links** | [Onfleet API method](http://docs.onfleet.com/Content/administrators#list-administrators "Opens in new tab: Onfleet API method") |

administrators table foreign keys

| Join administrators with | on |
| --- | --- |
| [tasks](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Onfleet.htm#tasks) | ```<br>administrators.id = tasks.creator<br>```<br><br>```<br>administrators.organization = tasks.organization<br>``` |
| [teams](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Onfleet.htm#teams) | ```<br>administrators.id = teams.managers<br>``` |
| [organizations](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Onfleet.htm#organizations) | ```<br>administrators.organization = organizations.id<br>```<br><br>```<br>administrators.organization = organizations.delegatees<br>``` |
| [workers](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Onfleet.htm#workers) | ```<br>administrators.organization = workers.organization<br>``` |

administrators table schema

| **email**<br><br><br>STRING |
| --- |
| **id**<br><br><br>STRING |
| **isActive**<br><br><br>BOOLEAN |
| **metadata**<br><br><br>ARRAY<br><br>This is a nested data structure. |
| **name**<br><br><br>STRING |
| **organization**<br><br><br>STRING |
| **phone**<br><br><br>STRING |
| **timeCreated**<br><br><br>DATE-TIME |
| **timeLastModified**<br><br><br>DATE-TIME |
| **type**<br><br><br>STRING |

### hubs

The `hubs` table contains info about the hubs, or depots, for teams in your Onfleet account. A hub is the location from which all deliveries for a team’s workers start.

| **Replication Method** | Full Table |
| --- | --- |
| **Primary Key** | id |
| **Useful links** | [Onfleet documentation](http://docs.onfleet.com/Content/hubs)<br><br>[Onfleet API method](http://docs.onfleet.com/Content/hubs#list-hubs "Opens in new tab: Onfleet API method") |

hubs table foreign keys

| Join hubs with | on |
| --- | --- |
| [teams](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Onfleet.htm#teams) | ```<br>hubs.id = teams.hub<br>```<br><br>```<br>hubs.teams = teams.id<br>``` |
| [workers](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Onfleet.htm#workers) | ```<br>hubs.teams = workers.teams<br>``` |

hubs table schema

| **address**<br><br><br>OBJECT<br><br>This is a nested data structure:<br><br><ul><li>apartment: STRING</li><li>city: STRING</li><li>country: STRING</li><li>number: STRING</li><li>postalCode: STRING</li><li>state: STRING</li><li>street: STRING</li></ul> |
| --- |
| **id**<br><br><br>STRING |
| **location**<br><br><br>ARRAY |
| **name**<br><br><br>STRING |
| **teams**<br><br><br>ARRAY<br><br>This is a nested data structure. |

### organizations

The `organizations` table contains info about the organizations in your Onfleet account. In Onfleet, an organization is the top-most entity - it contains administrators, teams, works, and tasks, all of which belong to the organization.

| **Replication Method** | CDC |
| --- | --- |
| **Primary Key** | id |
| **Replication Key** | timeLastModified |
| **Useful links** | [Onfleet documentation](http://docs.onfleet.com/Content/organizations)<br><br>[Onfleet API method](http://docs.onfleet.com/Content/organizations#get-details "Opens in new tab: Onfleet API method") |

organizations table foreign keys

| Join organizations with | on |
| --- | --- |
| [administrators](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Onfleet.htm#administrators) | ```<br>organizations.id = administrators.organization<br>```<br><br>```<br>organizations.delegatees = administrators.organization<br>``` |
| [tasks](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Onfleet.htm#tasks) | ```<br>organizations.id = tasks.organization<br>```<br><br>```<br>organizations.delegatees = tasks.organization<br>``` |
| [workers](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Onfleet.htm#workers) | ```<br>organizations.id = workers.organization<br>```<br><br>```<br>organizations.delegatees = workers.organization<br>``` |

organizations table schema

| **country**<br><br><br>STRING |
| --- |
| **delegatees**<br><br><br>ARRAY<br><br>This is a nested data structure. |
| **email**<br><br><br>STRING |
| **id**<br><br><br>STRING |
| **image**<br><br><br>STRING |
| **name**<br><br><br>STRING |
| **timeCreated**<br><br><br>DATE-TIME |
| **timeLastModified**<br><br><br>DATE-TIME |
| **timezone**<br><br><br>STRING |

### tasks

The `tasks` table contains info about the tasks in your Onfleet account. Tasks are units of work that [`administrators`](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Onfleet.htm#administrators) create and assign to [`workers`](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Onfleet.htm#workers) for completion.

| **Replication Method** | CDC |
| --- | --- |
| **Primary Key** | id |
| **Replication Key** | timeLastModified |
| **Useful links** | [Onfleet documentation](http://docs.onfleet.com/Content/tasks)<br><br>[Onfleet API method](http://docs.onfleet.com/Content/tasks#list-tasks "Opens in new tab: Onfleet API method") |

tasks table foreign keys

| Join tasks with | on |
| --- | --- |
| [administrators](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Onfleet.htm#administrators) | ```<br>tasks.creator = administrators.id<br>```<br><br>```<br>tasks.organization = administrators.organization<br>``` |
| [teams](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Onfleet.htm#teams) | ```<br>tasks.creator = teams.managers<br>```<br><br>```<br>tasks.id = teams.tasks<br>```<br><br>```<br>tasks.worker = teams.workers<br>``` |
| [organizations](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Onfleet.htm#organizations) | ```<br>tasks.organization = organizations.id<br>```<br><br>```<br>tasks.organization = organizations.delegatees<br>``` |
| [workers](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Onfleet.htm#workers) | ```<br>tasks.organization = workers.organization<br>```<br><br>```<br>tasks.id = workers.activeTask<br>```<br><br>```<br>tasks.id = workers.tasks<br>```<br><br>```<br>tasks.worker = workers.id<br>``` |

tasks table schema

| **completeAfter**<br><br><br>NUMBER |
| --- |
| **completeBefore**<br><br><br>NUMBER |
| **completionDetails**<br><br><br>OBJECT<br><br>This is a nested data structure:<br><br><ul><li>events: ARRAY, which is also a nested data structure.</li><li>failureReason: STRING</li><li>firstLocation: ARRAY, which is also a nested data structure.</li><li>lastLocation: ARRAY, which is also a nested data structure.</li><li>time: DATE-TIME</li><li>unavailableAttachments: ARRAY, which is also a nested data structure.</li></ul> |
| **creator**<br><br><br>STRING |
| **delayTime**<br><br><br>NUMBER |
| **dependencies**<br><br><br>ARRAY<br><br>This is a nested data structure. |
| **destination**<br><br><br>OBJECT<br><br>This is a nested data structure:<br><br><ul><li>address: OBJECT, which is also a nested data structure.											<ul><li>apartment: STRING</li><li>city: STRING</li><li>country: STRING</li><li>number: STRING</li><li>postalCode: STRING</li><li>state: STRING</li><li>street: STRING</li></ul></li><li>id: STRING</li><li>location: ARRAY, which is also a nested data structure.</li><li>metadata: ARRAY, which is also a nested data structure.</li><li>notes: STRING</li><li>timeCreated: DATE-TIME</li><li>timeLastModified: DATE-TIME</li></ul> |
| **estimatedCompletionTime**<br><br><br>NUMBER |
| **executor**<br><br><br>STRING |
| **feedback**<br><br><br>ARRAY<br><br>This is a nested data structure. |
| **id**<br><br><br>STRING |
| **identity**<br><br><br>OBJECT<br><br>This is a nested data structure:<br><br><ul><li>checksum: STRING</li><li>failedScanCount: NUMBER</li></ul> |
| **merchant**<br><br><br>STRING |
| **metadata**<br><br><br>ARRAY<br><br>This is a nested data structure. |
| **notes**<br><br><br>STRING |
| **organization**<br><br><br>STRING |
| **overrides**<br><br><br>OBJECT<br><br>This is a nested data structure. |
| **pickupTask**<br><br><br>BOOLEAN |
| **quantity**<br><br><br>NUMBER |
| **recipients**<br><br><br>ARRAY<br><br>This is a nested data structure:<br><br><ul><li>id: STRING</li><li>metadata: ARRAY, which is also a nested data structure.</li><li>name: STRING</li><li>notes: STRING</li><li>organization: STRING</li><li>phone: STRING</li><li>skipSMSNotifications: BOOLEAN</li><li>timeCreated: DATE-TIME</li><li>timeLastModified: DATE-TIME</li></ul> |
| **serviceTime**<br><br><br>NUMBER |
| **shortId**<br><br><br>STRING |
| **sourceTaskId**<br><br><br>STRING |
| **state**<br><br><br>NUMBER |
| **timeCreated**<br><br><br>DATE-TIME |
| **timeLastModified**<br><br><br>DATE-TIME |
| **trackingURL**<br><br><br>STRING |
| **trackingViewed**<br><br><br>BOOLEAN |
| **worker**<br><br><br>STRING |

### teams

The `teams` table contains info about the teams in your Onfleet account.

| **Replication Method** | CDC |
| --- | --- |
| **Primary Key** | id |
| **Replication Key** | timeLastModified |
| **Useful links** | [Onfleet documentation](http://docs.onfleet.com/Content/teams)<br><br>[Onfleet API method](http://docs.onfleet.com/Content/teams#list-teams "Opens in new tab: Onfleet API method") |

teams table foreign keys

| Join teams with | on |
| --- | --- |
| [administrators](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Onfleet.htm#administrators) | ```<br>teams.managers = administrators.id<br>``` |
| [tasks](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Onfleet.htm#tasks) | ```<br>teams.managers = tasks.creator<br>```<br><br>```<br>teams.tasks = tasks.id<br>```<br><br>```<br>teams.workers = tasks.worker<br>``` |
| [hubs](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Onfleet.htm#hubs) | ```<br>teams.hub = hubs.id<br>```<br><br>```<br>teams.id = hubs.teams<br>``` |
| [workers](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Onfleet.htm#workers) | ```<br>teams.tasks = workers.activeTask<br>```<br><br>```<br>teams.tasks = workers.tasks<br>```<br><br>```<br>teams.id = workers.teams<br>```<br><br>```<br>teams.workers = workers.id<br>``` |

teams table schema

| **hub**<br><br><br>STRING |
| --- |
| **id**<br><br><br>STRING |
| **managers**<br><br><br>ARRAY<br><br>This is a nested data structure. |
| **name**<br><br><br>STRING |
| **tasks**<br><br><br>ARRAY<br><br>This is a nested data structure. |
| **timeCreated**<br><br><br>DATE-TIME |
| **timeLastModified**<br><br><br>DATE-TIME |
| **workers**<br><br><br>ARRAY<br><br>This is a nested data structure. |

### workers

The `workers` table contains info about the workers (or drivers) in your Onfleet account. Workers are organization members who complete tasks.

| **Replication Method** | CDC |
| --- | --- |
| **Primary Key** | id |
| **Replication Key** | timeLastModified |
| **Useful links** | [Onfleet documentation](http://docs.onfleet.com/Content/workers)<br><br>[Onfleet API method](http://docs.onfleet.com/Content/workers#list-workers "Opens in new tab: Onfleet API method") |

workers table foreign keys

| Join workers with | on |
| --- | --- |
| [administrators](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Onfleet.htm#administrators) | ```<br>workers.organization = administrators.organization<br>``` |
| [organizations](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Onfleet.htm#organizations) | ```<br>workers.organization = organizations.id<br>```<br><br>```<br>workers.organization = organizations.delegatees<br>``` |
| [tasks](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Onfleet.htm#tasks) | ```<br>workers.organization = tasks.organization<br>```<br><br>```<br>workers.activeTask = tasks.id<br>```<br><br>```<br>workers.tasks = tasks.id<br>```<br><br>```<br>workers.id = tasks.worker<br>``` |
| [teams](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Onfleet.htm#teams) | ```<br>workers.activeTask = teams.tasks<br>```<br><br>```<br>workers.tasks = teams.tasks<br>```<br><br>```<br>workers.teams = teams.id<br>```<br><br>```<br>workers.id = teams.workers<br>``` |
| [hubs](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Onfleet.htm#hubs) | ```<br>workers.teams = hubs.teams<br>``` |

workers table schema

| **accountStatus**<br><br><br>STRING |
| --- |
| **activeTask**<br><br><br>STRING |
| **capacity**<br><br><br>NUMBER |
| **delayTime**<br><br><br>NUMBER |
| **displayName**<br><br><br>STRING |
| **id**<br><br><br>STRING |
| **imageUrl**<br><br><br>STRING |
| **location**<br><br><br>STRING |
| **metadata**<br><br><br>ARRAY<br><br>This is a nested data structure. |
| **name**<br><br><br>STRING |
| **onDuty**<br><br><br>BOOLEAN |
| **organization**<br><br><br>STRING |
| **phone**<br><br><br>STRING |
| **tasks**<br><br><br>ARRAY<br><br>This is a nested data structure. |
| **teams**<br><br><br>ARRAY<br><br>This is a nested data structure. |
| **timeCreated**<br><br><br>DATE-TIME |
| **timeLastModified**<br><br><br>DATE-TIME |
| **timeLastSeen**<br><br><br>DATE-TIME |
| **userData**<br><br><br>OBJECT<br><br>This is a nested data structure:<br><br><ul><li>appVersion: STRING</li><li>batteryLevel: NUMBER</li><li>deviceDescription: STRING</li><li>platform: STRING</li></ul> |
| **vehicle**<br><br><br>OBJECT<br><br>This is a nested data structure:<br><br><ul><li>color: STRING</li><li>description: STRING</li><li>id: STRING</li><li>licensePlate: STRING</li><li>timeLastModified: DATE-TIME</li><li>type: STRING</li></ul> |