Follow

Workforce Management - Jobs and Tasks

Updated

To send a Job to a vehicle, it is necessary to start by creating the first task in the Job. This will create the job automatically. For that, the method POST /v2/jobs/tasks should be used. Do not pass a jobId, so that a new Job is created.

Is is also necessary to indicate the task type. Task types must be defined in the Intranet by you Frotcom Certified Partner. The API method GET /v2/jobs/types retrieves the existing task types and their IDs.

After adding the first task, a jobId is returned, which can be used when adding other tasks to the same job. A taskId is also returned.

To delete a task not yet assigned to a vehicle, use the method DELETE /v2/jobs/{jobId}/tasks/{id}. If the job only had this task, the job will also be deleted. It is not possible to delete tasks on jobs that have already been assigned.

To delete a pending job (not yet assigned), use the method DELETE /v2/jobs/{jobId}. This will first delete all tasks inside the job.

To assign the job to a vehicle, the following method should be used: POST /v2/vehicles/{vehicleId}/assignJobs. Supply the list of jobs to assing in the body, using the format [jobId1, jobId2, ...]. Jobs are sent to the Workforce Management terminal at this point.

To get the status of a task, the method to use is GET /v2/jobs/{idJob}/task/{idTask}.

The method GET /v2/vehicles/{vehicleId}/activity?jobId={jobId}&taskId={taskId} retrieves the driver activities during a task. The response will include a formResultId if the activity involved sending a task related form (such as a POD). Then, use the method GET /v2/interact/received/{formResultId} to retrieve all the details of the form, including an array with all the fields filled in by the driver.

For fields with fieldType: "picture" or fieldType :"signature", use the resultValue value as a parameter to method GET /v2/interact/pictures?ids={id} to get the picture content. The api will return the jpeg binary content base64 encoded.

Alternatively, the method POST /v2/interact/received/Forms can be used to retrieve all forms received in a period of time. To get the list of fields, you still need to get the details one form at a time.

It is possible to deassign jobs already assigned to a vehicle. This changes the Job status to Canceled. Any task in execution will also be canceled. If there are tasks not yet started, a new job is created with those tasks, and the job status will be Pending, the same as a new unassigned job. The method to deassign a job is POST /v2/vehicles/{vehicleId}/deassignJobs. The body has two mandatory fields: jobId and vehicleId.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk