Example API Request: Update (PUT) Occupancy Chemical

Before Getting Started

Additional documentation for the Agency Occupancies API can be found here.

Update (PUT) Occupancy Chemical

  1. Run a GET Occupancies request and make note of the applicable occupancyID
    • GET https://data.emergencyreporting.com/agencyoccupancies/occupancies
    • "occupancyID": "12345xx"
  2. Using the occupancyID, run a GET Chemicals request to view chemicals associated with that Occupancy
    • GET https://data.emergencyreporting.com/agencyoccupancies/occupancies/{OccupancyID}/chemicals
  3. Review results, make sure that at least one chemical is returned and make note of the occupancyChemicalInventoryID you would like to update
    • If no chemical is returned from a GET Chemicals request, stop and make sure to add (POST) a chemical before moving forward
        {
            "totalRows": "2",
            "occupancyChemicals": [
                {
                    "rowNum": "1",
                    "occupancyID": "12345xx",
                    "occupancyChemicalInventoryID": "1234x",
                    "occupancyChemicalListID": "112x",
                    "location": "Near East Wall",
                    "quantity": "1",
                    "containerType": "12",
                    "estimatedContainerCapacity": "5",
                    "capacityUnits": "12",
                    "notes": "Propane",
                    "archive": "0",
                    "rowVersion": "00000001A2345xxx",
                    "chemicalID": "1122x",
                    "name": "1,1-DICHLORO-1,2,2,3,3-PENTAFLUOROPROPANE"
                },
                {
                    "rowNum": "2",
                    "occupancyID": "54321xx",
                    "occupancyChemicalInventoryID": "4321x",
                    "occupancyChemicalListID": "334x",
                    "location": "Near West Wall",
                    "quantity": "2",
                    "containerType": "10",
                    "estimatedContainerCapacity": "16",
                    "capacityUnits": "11",
                    "notes": "Gasoline",
                    "archive": "0",
                    "rowVersion": "00000002B2345xxx",
                    "chemicalID": "3344x",
                    "name": "GASOLINE"
                }
            ]
        }
            
  4. Run a Update (PUT) Occupancy Chemical request making sure that ALL of the following chemical fields have been populated with data
    • PUT https://data.emergencyreporting.com/agencyoccupancies/occupancies/{occupancyID}/chemicals/{chemicalID}
    • If you're using results returned from your GET Chemicals request as a reference, remove the following fields and their values
      • "rowNum": "1",
      • "occupancyID": "12345xx",
      • "occupancyChemicalInventoryID": "1234x",
      • "occupancyChemicalListID": "112x",
      • "archive": "0",
      • "rowVersion": "00000001A2345xxx",
      • "name": "1,1-DICHLORO-1,2,2,3,3-PENTAFLUOROPROPANE"
    • In the following PUT request, only the location field is being updated, all other fields are being replaced with their original values
            HEADER
            Ocp-Apim-Subscription-Key: YOUR_PRODUCT_SUBSCRIPTION_PRIMARY_KEY
            Content-Type: application/json
            Authorization: YOUR_ACCESS_TOKEN
            ETag: 00000002B2345xxx
        
        {
            "chemical":
                {
                    "location": "Near North Wall",
                    "quantity": "1",
                    "containerType": "12",
                    "estimatedContainerCapacity": "5",
                    "capacityUnits": "12",
                    "notes": "Propane"
                }
        }
        

Troubleshooting

If incomplete or incorrect data was sent for an Occupancy Chemical and you receive a 500 error, the Chemical may need to be deleted from PreFire Plans by sending a Delete Occupancy Chemical request.


Back to Top