Use case
Instead of creating an incident and letting FireServiceRota determine which users should be alerted (e.g. based on fairness, availability and skills), there is a need to alert one or more specific users. This can be used, for example, for nearest officer mobilisation, testing, or an integration with an external mobilising system.
Process
Step 0. Obtain an API token
Step 1. Identify memberships that should be alerted
This step is application specific, but there are a couple of possibilities:
A. Finding a candidate within a group
- Find the memberships of the station in which the incident should be created: GET /api/v2/groups/[id].
- From the memberships array in the group JSON, get the user IDs
- Get the associated users: GET /api/v2/users/id1,id2,id3
- Find the user(s) you wish to alert
- Get the memberships from step 2 associated with the user(s)
B. Finding the membership for a user
- Get the user record: GET /api/v2/users/[id]
- From the memberships array in the user JSON, find the group IDs
- Get the associated groups: GET /api/v2/groups/id1,id2,id3
- Find the group in which you wish to create an incident for the user
- Get the memberships from step 2 associated with the group
We are happy to advise you which option is best for your application.
Step 2. Create the incident
The most important part here is the new field override_responder_membership_ids. Set this to the membership IDs gathered in the previous step.
curl --request POST -H "Authorization: Bearer [token]" https://www.fireservicerota.co.uk/api/v2/incidents/ -H "Content-Type: application/json" -d '{"override_responder_membership_ids": [1,2,3], "body": "Manual Responder Selection"}'
Comments
0 comments
Article is closed for comments.