Example API Request: Using the PATCH Method

The PATCH method is a quick and easy way to update endpoint field values without fully replacing all fields belonging in an endpoint. Here are a few examples of PATCH methods that can be utilized to update information in the system.

Before Getting Started

  • Review the Authorization section of the Guides page
  • Configure Postman with a valid Access token using the Authorization Code Grant type
  • Make sure you are subscribed to the applicable product/APIs:
    • Agency Incidents (for "Update Apparatus Response Mode to Scene" and "Mark Patient Record as Authorized from Third Party Vendor" below)
    • Agency Users (v2) (for "Update Personnel's 'agencyPersonnelID' using PATCH Method" below)

Update Apparatus Response Mode to Scene

If you'd like to send an updated Response Mode to Scene for an Apparatus, submit the following request(s).

  • Apparatus Response Mode to Scene can be found within the ERS UI at: Incidents > [Select Incident] > Basic 4 > [Select Apparatus] > Response Mode

  1. Submit a Get Incidents request to locate the incidentID of the Incident
  2.     Header
        Ocp-Apim-Subscription-Key: [YourSubscriptionKey]
        content-type: application/json
        Authorization: [YourAccessToken]
    
        Request URL
        GET https://data.emergencyreporting.com/agencyincidents/incidents
    
        Response
        {
            ...
            "incidentID": "123456xx",
            ...
        }​
    
  3. Using the incidentID, submit a Get Exposures request to find a corresponding exposureID
    • In your request URL, replace {incidentID} with 123456xx
        Header
        Ocp-Apim-Subscription-Key: [YourSubscriptionKey]
        content-type: application/json
        Authorization: [YourAccessToken]
    
        Request URL
        GET https://data.emergencyreporting.com/agencyincidents/incidents/123456xx/exposures
        
        Response
        {
            ...
            "exposureID": "765432xx",
            ...
        }​
    
  4. Submit a Get Exposure Apparatuses request to locate the apparatusID and the latest rowVersion of the Apparatus you'd like to Patch
    • In your request URL, replace {exposureID} with 765432xx
        Header
        Ocp-Apim-Subscription-Key: [YourSubscriptionKey]
        content-type: application/json
        Authorization: [YourAccessToken]
    
        Request URL
        GET https://data.emergencyreporting.com/agencyincidents/exposures/765432xx/apparatuses
    
        Response
        {
            ...
            "apparatusID": "112233xx",
            "rowVersion": "0000000123ABC456"
            ...
        }​
    
  5. Submit a PATCH Exposure Apparatus request with the most up-to-date rowVersion (ETag) included in the Header
    • In your request URL, replace {exposureID} with 765432xx and {apparatusID} with 112233xx
        Header
        Ocp-Apim-Subscription-Key: [YourSubscriptionKey]
        content-type: application/json
        Authorization: [YourAccessToken]
        ETag: 0000000123ABC456
    
        Request URL
        PATCH https://data.emergencyreporting.com/agencyincidents/exposures/765432xx/apparatuses/112233xx
        
        Request Body
        {
            "responseModeToScene": "390"
        }​
    
        Response
        {
            "rowVersion": "0000000456DEF789"
        }
    

Mark Patient Record as Authorized from Third Party Vendor

After sending a Patient PDF using the POST Patient PDF endpoint, you will need to mark the Patient PDF as "Authorized from Third Party Vendor". Submit the following requests to update Exposure Patient isAuthorized value from 0 (Not Authorized) to 1 (Authorized).

  • The "Authorized from Third Party Vendor" notification will be posted to the Patient PDF record in the ERS UI at: Incidents > [Select Incident] > EMS

  1. Submit a Get Incidents request to locate the incidentID of the Incident
    • See "Update Apparatus Response Mode to Scene" example above
  2. Using the incidentID, submit a Get Exposures request to find a corresponding exposureID
    • We'll use the same incidentID as above (1233456xx)
  3. Submit a Get Exposure Patients request to locate the patientID and latest rowVersion of the Patient record you'd like to Patch
    • Use the same exposureID as above (765432xx)
        Header
        Ocp-Apim-Subscription-Key: [YourSubscriptionKey]
        content-type: application/json
        Authorization: [YourAccessToken]
    
        Request URL
        GET https://data.emergencyreporting.com/agencyincidents/exposures/765432xx/patients
    
        Response
        {
            "patients": [
                {
                ...
                "PatientID": "-12345567xx",
                ...
                "rowVersion": "0000000111GHJ222"
                ...
                }
            ]
        }​
    
  4. Now that you have the PatientID and latest rowVersion, submit a Patch Exposure Patient request with the latest rowVersion (ETag) included in the Header to mark the Patient record as "Authorized from Third Party Vendor"
    • In your request URL, replace {exposureID} with 765432xx and patientID with -12345567xx
  5.     Header
        Ocp-Apim-Subscription-Key: [YourSubscriptionKey]
        content-type: application/json
        Authorization: [YourAccessToken]
        ETag: 0000000111GHJ222
    
        Request URL
        PATCH https://data.emergencyreporting.com/agencyincidents/exposures/765432xx/patients/-12345567xx
    
        Request Body
        {
            "isAuthorized": "1"
        }​
    
        Response
        {
            "rowVersion": "0000000333KLM444"
        }​
    
  6. Submit a Get Exposure Patient request to verify isAuthorized has been updated from 0 to 1
    • In your request URL, replace {exposureID} with 765432xx and patientID with -12345567xx
    • The authorizedDateTime value will be automatically updated to the time in which the update was posted
    • In most scenarios, the authorizedByUserID value will typically reflect the User ID of the API User that posted the update
        Header
        Ocp-Apim-Subscription-Key: [YourSubscriptionKey]
        content-type: application/json
        Authorization: [YourAccessToken]
    
        Request URL
        GET https://data.emergencyreporting.com/agencyincidents/exposures/765432xx/patients/-12345567xx
    
        Response
        {
            ...
            "isAuthorized": "1",
            "authorizedDateTime": "2030-01-01 12:00:00.053",
            "authorizedByUserID": "1234xx",
            ...
        }
    

Update Personnel's "agencyPersonnelID" using PATCH Method

If you're in need of applying a unique agency identifier like agencyPersonnelID to a user, you can utilize the PATCH User endpoint.

  • In this example, the agencyPersonnelID will be updated from null to jfirefighter

  1. Submit a GET Users request to locate the Personnel userID and the latest rowVersion of the record
        Header
        Ocp-Apim-Subscription-Key: [YourSubscriptionKey]
        content-type: application/json
        Authorization: [YourAccessToken]
    
        Request URL
        GET https://data.emergencyreporting.com/agencyusers/v2/users
        
        Response
        {
            "userID": "1234xx",
            "agencyPersonnelID": null,
            "fullName": "Firefighter, Jim",
            ...
            "rowVersion": "0000000123ABC456"
        }
    
  2. Submit a PATCH User request to update the agencyPersonnelID value field from null to jfirefighter.
    • Add the lastest rowVersion value of 0000000123ABC456 as an ETag value in your Header
    • In your Request URL, replace {userID} with 1234xx
    • For this request in particular, make sure brackets [ ] as well as curly braces { }are included in the Request Body
        Header
        Ocp-Apim-Subscription-Key: [YourSubscriptionKey]
        content-type: application/json
        Authorization: [YourAccessToken]
        ETag: 0000000123ABC456
    
        Request URL
        PATCH https://data.emergencyreporting.com/agencyusers/v2/users/1234xx
        
        Request Body
        [
            {
                "op": "replace",
                "path": "/agencyPersonnelID",
                "value": "jfirefighter"
            }
        ]
    
        Response
        {
            "rowVersion": "0000000123DEF789"
        }
    

Back to Top