Fetching entity_tags associated to a task
26 days ago
Is there a more efficient way of fetching tags associated to a task?
From the API
https://developers.fieldwire.com/reference/get_tasks_tags
this does not take a task ID so it is not specific to a task. It also returns a complex object of array of array of UIDs, where one is a task ID and the other the tag ID.
To use this from working back from a task you need to:
- Get all the task_tags
- Get the task of interest
- Loop through the task tags array and then check the array at the current index contains the taskID, if so use the entity_tag ID,
- As there can be multiple tags per task, the full array needs to be searched and cannot be terminated early.
The response to Get all the task_tags can be reshaped for more efficient output (create a map of array - the key the task ID and the array is associated entity_tags) but adds complexity to client code.