TrackerPro Admin API: Contents
September 23, 2024
TrackerPro Admin API: Vehicles
September 27, 2024
TrackerPro Admin API: Contents
September 23, 2024
TrackerPro Admin API: Vehicles
September 27, 2024

TrackerPro Admin API: Task

Task information is sent to and from the API in a TasksDataSet table.

Calls in this section


GetTasksByDate

Bulk retrieve tasks for a client by date range.

Request (Query Parameters)
ParameterValueNotes
opTaskRequired
subopGetTasksByDateRequired
companyClient/Account nameRequired
fromDate{number millisecs since 1970-01-01}Required
toDate{number millisecs since 1970-01-01}Required
dtmDatetime format for returned data. By default will return dates as millisecs since 1970-01-01. Set to ‘o’ if you want the format “2024-09-10T09:00:00.0000000”Optional

Example

 

Response

The dataset returned is a TasksDataSet. This dataset is returned by a number of other Task calls. Note that the example below shows a full return from the API. the TaskDataSet is the highlighted section.

{
  "version": "0.6",
  "reqId": "",
  "status": "ok",
  "sig": "-2122412833",
  "dataset": {
    "datasetname": "TasksDataSet",
    "tables": [
      {
        "cols": [
          {"id": "0","label": "TaskID","type": "number","p":{"autoincrement":true}},
          {"id": "1","label": "ExtID","type": "number"},
          {"id": "2","label": "Type","type": "string"},
          {"id": "3","label": "Name","type": "string"},
          {"id": "4","label": "Description","type": "string"},
          {"id": "5","label": "StartDateTime","type": "datetime"},
          {"id": "6","label": "EndDateTime","type": "datetime"},
          {"id": "7","label": "GracePeriodMins","type": "number"},
          {"id": "8","label": "AssignedTo","type": "string"},
          {"id": "9","label": "RegionGeoJson","type": "string"},
          {"id": "10","label": "ParameterJson","type": "string"},
          {"id": "11","label": "Status","type": "string"},
          {"id": "12","label": "ETA","type": "datetime"},
          {"id": "13","label": "ArrivedDateTime","type": "datetime"},
          {"id": "14","label": "DepartedDateTime","type": "datetime"},
          {"id": "15","label": "ModifierID","type": "number"}
        ],
        "rows": [
		  {"c": [
				{"v": 2},
				{"v": 666},
				{"v": "APPOINTMENT"},
				{  "v": "MyName"},
				{  "v": "MyDescription"},
				{  "v": "2024-09-10T09:00:00.0000000"},
				{  "v": "2024-09-10T10:00:00.0000000"},
				{  "v": 60},
				{  "v": "5121,5151"},
				{  "v": "{\"type\": \"Point\",\"coordinates\": [-1.8198263664727126,53.925394269663265],\"radius\": 200}"},
				{  "v": "{}"},
				{  "v": "PENDING"},
				{  "v": null},
				{  "v": null},
				{  "v": null},
				{  "v": 0}
				],
            "p": {"rowstate": "unchanged"}
          }
        ],
        "p": {"tablename": "Tasks","primarykey": [0]}
      }
    ]
  }
}

Fields to node include

  • TaskID (number) – internal PAYT autoincrement id
  • ExtID (number) – external id. Can be set to null, otherwise expected to be unique.
  • Type (string) – Task type. Suggest using ‘APT’, ‘JOB’ etc
  • Name (string) – Task short name
  • Description(string) – Task long name
  • StartDateTime (datetime, see dtm format)- Task start
  • EndDateTime (datetime, see dtm format)– Task end
  • GracePeriodMins (number) – Period in minutes before/after task start/end when task is ‘live’
  • AssignedTo (string) – Comma delimited list of assigned vehicles
  • RegionGeoJson (string) – This is in a modified (escaped) geojson format. Will support only Point and Polygon. Example {“type”: “Point”,”coordinates”: [-1.3198263664727126,53.125394269663265],”radiusM”: 200}
  • ParameterJson (string) – This is a dynamic json (escaped) payload
    You can put (within reason) whatever you want in this field. We will need to discuss how/what gets put on the task flag. Or just use the description field with HTML? You can add ids etc to link back to your database?
  • Status (string) Expecting ‘PENDING’, ‘ARRIVED’, ‘COMPLETE’. Possibly more, ‘OVERDUE’. Need to discuss.
    • PENDING – live task, vehicle not arrived
    • ARRIVED – live task, vehicle arrived but not left
    • COMPLETE – live task, vehicle departed
    • OVERDUE – live task, vehicle not arrived and after start time but within grace period?
  • ETA (readonly, datetime, see dtm format) – Task ETA
    Will update with vehicle ETA. This will be medium term objective. Lets get the tasks in and on the map first!
  • ArrivedDateTime (readonly, datetime, see dtm format) – Actual arrival. Updated with actual arrived datetime UTC
  • DepartedDateTime (readonly, datetime, see dtm format) – Actual departure. Updated with actual departure datetime UTC
  • ModifierID (readonly, number) – PAYT user ID

Update

This section provides an overview of how to add/remove Tasks. Multiple tasks can be synchronised with the PAYT interface in one go. Tasks are updated in bulk, failure in any task update will result in a failure in all tasks in the batch.

Request (Query Parameters)
ParameterValueNotes
opTaskRequired
subopUpdateRequired
company{Client/Account name}Required
dsTasks{TaskDataSet} (cols property can be omitted)Required
Example Exanded dsTasks Parameter

Note that as with all DataSet parameters, the ‘cols’ can be omitted when performing an update. The rowstate must be set to ‘added’, ‘modified’, ‘deleted’. If set to ‘unchanged’, the row will be ignored.

 

{
    "datasetname": "TasksDataSet",
    "tables": [
      {
        "rows": [
		  {"c": [
				{"v": 0},
				{"v": 666},
				{"v": "APPOINTMENT"},
				{"v": "MyName"},
				{"v": "MyDescription"},
				{"v":1725958800000},
                                {"v":1725962400000}
				{"v": 60},
				{"v": "5121,5151"},
				{"v": "{\"type\": \"Point\",\"coordinates\":[-1.8198263664727126,53.925394269663265],\"radius\": 200}"},
				{"v": "{}"},
				{"v": "PENDING"},
				{"v": null},
				{"v": null},
				{"v": null},
				{"v": 0}
			],
            "p": {"rowstate": "added"}
          }
        ],
        "p": {"tablename": "Tasks","primarykey": [0]}
      }
    ]
  }

Example Request (add single task)

Request is made to standard url (https://trackerpro.payasyoutrack.com/trackerpro_admin.ashx) with form data (which will be url encoded as part of the post request) as:

op: Task
subop: Update
dsTasks: {“datasetname”:”TaskDataSet”,”tables”:[{“rows”:[{“c”:[{“v”:0},{“v”:666},{“v”:”APPOINTMENT”},{“v”:”MyName”},{“v”:”MyDescription”},{“v”:”2024-09-10T09:00:00.000Z”},{“v”:”2024-09-10T10:00:00.000Z”},{“v”:60},{“v”:”5121,5151″},{“v”:”{\”type\”:\”Point\”,\”coordinates\”:[-1.8198263664727126,53.925394269663265],\”radius\”:200}”},{“v”:”{}”},{“v”:”PENDING”},{“v”:null},{“v”:null},{“v”:null},{“v”:0}],”p”:{“rowstate”:”added”}}],”p”:{“tablename”:”Tasks”,”primarykey”:[0]}}]}
ticket: {XXXXADMINKEYXXXX}

Note that the TaskID is set to 0, this will be autoassigned by PAYT after the task is created.

Example Request (add multiple tasks)

Request is made to standard url (https://trackerpro.payasyoutrack.com/trackerpro_admin.ashx) with form data (which will be url encoded as part of the post request) as:

op: Task
subop: Update
dsTasks: {“datasetname”:”TaskDataSet”,”tables”:[{“rows”:[{“c”:[{“v”:0},{“v”:666},{“v”:”APPOINTMENT”},{“v”:”MyName”},{“v”:”MyDescription”},{“v”:”2024-09-10T09:00:00.000Z”},{“v”:”2024-09-10T10:00:00.000Z”},{“v”:60},{“v”:”5121,5151″},{“v”:”{\”type\”:\”Point\”,\”coordinates\”:[-1.8198263664727126,53.925394269663265],\”radius\”:200}”},{“v”:”{}”},{“v”:”PENDING”},{“v”:null},{“v”:null},{“v”:null},{“v”:0}],”p”:{“rowstate”:”added”}},{“c”:[{“v”:0},{“v”:666},{“v”:”APPOINTMENT”},{“v”:”MyName2″},{“v”:”MyDescription2″},{“v”:”2024-09-10T09:00:00.000Z”},{“v”:”2024-09-10T10:00:00.000Z”},{“v”:60},{“v”:”5121,5151″},{“v”:”{\”type\”:\”Point\”,\”coordinates\”:[-0.8198263664727126,53.925394269663265],\”radius\”:200}”},{“v”:”{}”},{“v”:”PENDING”},{“v”:null},{“v”:null},{“v”:null},{“v”:0}],”p”:{“rowstate”:”added”}}],”p”:{“tablename”:”Tasks”,”primarykey”:[0]}}]}
ticket: {XXXXADMINKEYXXXX}

Note that the TaskID is set to 0, this will be auto assigned by PAYT after the task is created.

Example Request (delete task)

Request is made to standard url (https://trackerpro.payasyoutrack.com/trackerpro_admin.ashx) with form data (which will be url encoded as part of the post request) as:

op: Task
subop: Update
dsTasks: {“datasetname”:”TaskDataSet”,”tables”:[{“rows”:[{“c”:[{“v”:33},{“v”:666},{“v”:”APPOINTMENT”},{“v”:”MyName”},{“v”:”MyDescription”},{“v”:”2024-09-10T09:00:00.000Z”},{“v”:”2024-09-10T10:00:00.000Z”},{“v”:60},{“v”:”5121,5151″},{“v”:”{\”type\”:\”Point\”,\”coordinates\”:[-1.8198263664727126,53.925394269663265],\”radius\”:200}”},{“v”:”{}”},{“v”:”PENDING”},{“v”:null},{“v”:null},{“v”:null},{“v”:0}],”p”:{“rowstate”:”added”}},{“c”:[{“v”:0},{“v”:666},{“v”:”APPOINTMENT”},{“v”:”MyName2″},{“v”:”MyDescription2″},{“v”:”2024-09-10T09:00:00.000Z”},{“v”:”2024-09-10T10:00:00.000Z”},{“v”:60},{“v”:”5121,5151″},{“v”:”{\”type\”:\”Point\”,\”coordinates\”:[-0.8198263664727126,53.925394269663265],\”radius\”:200}”},{“v”:”{}”},{“v”:”PENDING”},{“v”:null},{“v”:null},{“v”:null},{“v”:0}],”p”:{“rowstate”:”deleted”}}],”p”:{“tablename”:”Tasks”,”primarykey”:[0]}}]}
ticket: {XXXXADMINKEYXXXX}

Note that the TaskID *must* be provided to delete the task.

Back to: Contents



 

PAYT Icon for Apple Store