Employee : Assign to extra Regions

What you need to do is identify the employee.id value, and then post to the assign-extra-regions action while targeting that employee id, and include an array of region ids in the payload:

[POST] /employees/id/actions/assign-extra-regions

{ "regions": [5, 3, 28] }

id = the id of the employee, an integer.

5, 3, 28 = list of Region ID values (the id field in responses of /regions fetches)

The quality and accuracy of the validation error messages will improve once a well formed array of int is provided, like:

  • region does not exist (a region id in the array doesn't point to a region)

  • cannot add user main region as extra regions (a region id in the array is the region the employee belongs to)

  • cannot find entity (employee id specified in /employees/id/actions/assign-extra-regions doesn't point to an employee)

Verifying results / Find employees assigned to regions

You can use the endpoint /employee-extra-regions for a list of regions an employee has been assigned as an extra (non-primary), or to see which employees have been assigned to a region as an extra.

The TrackTik API has a new endpoint for listing the employees assigned to extra regions (non-primary, via the action: assign-extra-regions), or to get a list of employees assigned to a region as an extra (non-primary).

Basic endpoint usage:

GET /employee-extra-regions

Extra regions an employee is assigned to :

GET /employee-extra-regions?employee={id}

Employees assigned (non primary) to a region as an extra:

GET /employee-extra-regions?region={id}

Results will typically look like:

"data": [ { "employee": 1002, "region": 2, "id": 3 }, { "employee": 1004, "region": 2, "id": 42 }, { "employee": 1005, "region": 2, "id": 51 } ]
Was this article helpful?
0 out of 0 found this helpful

Articles in this section

See more