Adds task to jobs and create them if they don't exist
Adds task to jobs, creating the jobs if they don't exist.
If any of the tasks specifies JobId
with value 0
, then a new job will be created and all the tasks that specify JobId
with value 0
will be associated with it.
This job will be returned and any other tasks, if any was specified, are ignored.
If multiple tasks are being added to an existing job, they all should specify an existing JobId
.
The structures Who
, Where
, When
and What
of each task are not mandatory ; they may be defined only when necessary.
When any of these structures is defined, some validations are performed on their field's values.
Check section Response HTTP Codes > 400 below where the error condictions are enumerated.
Regarding sturcture Who
, this structure may be used by the Frontend to include one reference to a CRM client and/or one reference to an address.
The front end uses specificaly and only the fields ClientId and ContactId for this matter ; any other fields of the structure Who
are, at the moment of this writing, ignored by the Frontend.
Forms structure may also be included when necessary. When it is included a form is attached to the task as a set of fields and their specified values, concerning the following:
- The attached information is the one specified in the fields
name
andvalue
- Each field is only included in the form attachment if one of the following condition applies:
- The
defaultValue
is specified and thevalue
is not-1
, or - The
defaultValue
is not specified butvalue
is (notnull
nor empty string)
- The
Parameters
tasks
The parameter of this endpoint is an array of objects. Each object defines the data of a task to add as well as the ID of the job.
[{
"JobId": 0,
"TypeId" : int: Task type
"Who": {
"ClientId": 0,
"ContactId": 0,
"ContactName": "string",
"ClientName": "string",
"OfficePhone": "string",
"MobilePhone": "string"
}
"Where": {
"ClientAddressId": 0,
"AddressLine1": "string",
"AddressLine2": "string",
"ZipCode": "string",
"City": "string",
"CountryIso": "string",
"PlaceId": 0,
"Latitude": 0.0,
"Longitude": 0.0,
"instructions": "string",
"notes": "string"
}
"What":{
"Reference": "string",
"Content": "string",
"Quantity": 0,
"UnitId": 0,
"Notes": "string",
"Duration": 0
},
"When": {
"When": "noTimeRestriction",
"Start": "2023-08-23T14:36:13.182Z",
"End": "2023-08-23T14:36:13.182Z",
"Tolerance": true,
"ToleranceBefore": 0,
"ToleranceAfter": 0,
"Exclusion": true,
"ExclusionStart": "2023-08-23T14:36:13.182Z",
"ExclusionEnd": "2023-08-23T14:36:13.182Z"
},
"Forms":[
{
"id": 0,
"version": 0,
"name": "string",
"fields":[{
"name": "string"
"defaultValue": "string",
"value": "string"
}
]
}
]
}]
Field | Description | ||||||||||||||||
JobId | Job Id to associate the Task. If 0 is specified a new Job is created.
|
||||||||||||||||
TypeId | The Id if the type of the task
|
||||||||||||||||
Who | The structure in which is is possible to provate data about a client that is related to the task.
|
||||||||||||||||
Who.ClientId | Client Id (CRM Client)
|
||||||||||||||||
Who.ContactId | Contact Id (CRM Client)
|
||||||||||||||||
Who.ContactName | Contact name (CRM Client)
|
||||||||||||||||
Who.ClientName | Client name (CRM Client)
|
||||||||||||||||
Who.OfficePhone | Office phone (CRM Client)
|
||||||||||||||||
Who.MobilePhone | Mobile phone (CRM Client)
|
||||||||||||||||
Where | Structure that allows to include custom information about a place that is related to the task.
|
||||||||||||||||
Where.ClientAddressId | Client Address Id (CRM client)
|
||||||||||||||||
Where.AddressLine1 | Address line 1
|
||||||||||||||||
Where.AddressLine2 | Address line 2 Note:this field is deprecated. Frotcom applications (Frontend, Driver app, etc.) are currently using only the field Where.AddressLine1
|
||||||||||||||||
Where.ZipCode | The zip Code Note:this field is deprecated. Frotcom applications (Frontend, Driver app, etc.) are currently using only the field Where.AddressLine1
|
||||||||||||||||
Where.City | The city.
Note:this field is deprecated. Frotcom applications (Frontend, Driver app, etc.) are currently using only the field Where.AddressLine1
|
||||||||||||||||
Where.CountryIso | The ISO code that identifies the country. Note:this field is deprecated. Frotcom applications (Frontend, Driver app, etc.) are currently using only the field Where.AddressLine1
|
||||||||||||||||
Where.PlaceId | The Id of a place in the account
|
||||||||||||||||
Where.Latitude | The latitude of a place to reference
|
||||||||||||||||
Where.Longitude | The longitude of a place to reference
|
||||||||||||||||
Where.Instructions | Allows to include instructions about the location related with the task. Note: this field is deprecated. |
||||||||||||||||
Where.Notes | Allows to include notes about the location related with the task. |
||||||||||||||||
What.Reference | Allows to specify a custom reference for the task Enter a reference for the task
|
||||||||||||||||
What.Content | Products/Service
|
||||||||||||||||
What.Quantity | Indicate, if you must, a quantity related to the product or service
|
||||||||||||||||
What.UnitId | An ID that identifies the unit. See the table bellow
|
||||||||||||||||
What.Notes | Annotations field
|
||||||||||||||||
What.Duration | Duration
|
||||||||||||||||
When | Object that can be used to specify data about the date and time of the task
|
||||||||||||||||
When.When |
|
||||||||||||||||
When.Start |
If the field when is set to NoTimeRestriction , then this field must be null ;If the field when is set to TimeRange , then this field should be the start date of interval to arrive
|
||||||||||||||||
When.End |
If the field when is set to NoTimeRestriction or TimeAndTolerance , then this field must be null ;If the field when is set to TimeRange , then this field should be the end date of interval to arrive
|
||||||||||||||||
When.Tolerance | When set to true , allows to specify tolerances to the arrival time.
|
||||||||||||||||
When.ToleranceBefore | If the field when is set to TimeAndTolerance , and the field Tolerance is set to true ,
then this field specifies the tolerance, in seconds, before the arrival time; otherwise it should be null .
|
||||||||||||||||
When.ToleranceBefore | If the field when is set to TimeAndTolerance , and the field Tolerance is set to true ,
then this field specifies the tolerance, in seconds, after the arrival time; otherwise it should be null .
|
||||||||||||||||
When.Exclusion | Set to true if you want to exclude arrival in interval of dates
|
||||||||||||||||
When.ExclusionStart | If the field exclusion is set to true , then this should be the exclusion start date interval, otherwise it should be null ;
|
||||||||||||||||
When.ExclusionEnd | If the field exclusion is set to true , then this should be the exclusion end date interval, otherwise it should be null ;
|
||||||||||||||||
When.Forms | Allows to specify an array of forms to associate with the task
|
||||||||||||||||
When.Forms[index].id | The ID of a form in the account
|
||||||||||||||||
When.Forms[index].version | The version of the form to use
|
||||||||||||||||
When.Forms[index].Name | The name of the form to present to the user
|
||||||||||||||||
When.Forms[index].fields | Array of the fields of the form.
|
||||||||||||||||
When.Forms[task-index].fields[form-index].name | The name of the field
|
||||||||||||||||
When.Forms[task-index].fields[form-index].defaultValue | The default value of the field
|
||||||||||||||||
When.Forms[task-index].fields[form-index].value | The value of the field
|
Response Body
[
{
"id": 0,
"tasks" : [0],
"isNew": true
}
]
Field | Description |
id | The ID of the vehicle to where the route should be assigned
|
tasks | The ID of the vehicle to where the route should be assigned
|
isNew | The ID of the vehicle to where the route should be assigned
|
Response HTTP Codes
201 - Created
- The tasks were created
400 - Bad Request
JobTask
isnull
or is an empty array ofJobTask
TypeId
is0
JobTask.What.Reference
is notnull
andReference.Length
is bigger then400
JobTask.What.Content
is notnull
andContent.Length
is bigger then150
JobTask.What.UnitId
has value andUnitId
is lower then0
JobTask.What.Notes
is notnull
andNotes.Lenght
bigger then3000
JobTask.Where.PlaceId
has value andPlaceId
is0
JobTask.Where.AddressLine1
is notnull
andAddressLine1.Length
is bigger then300
JobTask.Where.AddressLine2
is notnull
andAddressLine2.Length
is bigger then150
JobTask.Where.ClientAddressId
has value andClientAddressId
is0
JobTask.Where.Latitude
has value andJobTask.Where.Longitude
isnull
JobTask.Where.Latitude
isnull
andJobTask.Where.Longitude
has valueJobTask.Where.Notes
is notnull
andNotes.Length
is bigger then500
JobTask.When.SLA
is true and one of the following fields is alsotrue
:When.ExclusionEnd
,When.ExclusionStart
,When.End
,When.Start
,When.ToleranceAfter
,When.ToleranceBefore
JobTask.When.ExclusionStart
value is bigger thenJobTask.When.ExclusionEnd
valueJobTask.When.ExclusionStart
has value andJobTask.When.ExclusionEnd
isnull
JobTask.When.ExclusionStart
isnull
andJobTask.When.ExclusionEnd
has valueJobTask.When.End
has value andWhen.Start
isnull
JobTask.When.End
isnull
,JobTask.When.Start
has value andJobTask.When.ToleranceAfter
orJobTask.When.ToleranceBefore
has value
403 - Forbidden
- The authenticated user doesn't have permissions to View Jobs