Example API Request: Using the "expand" Request Parameter

Before Getting Started

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

Using the "expand" Request Parameter

Now this is a nifty feature. If you'd like to include more than just the typical dataset returned from a GET request, you can tack the "expand" request parameter to the end of your request URL along with a specific field name. For this example, we'll be expanding the GET Occupancies call to show all Chemicals attached to each Occupancy in an account.

Do be aware that the "expand" request parameter is not available for all fields/endpoints.

  1. After authenticating, perform a Get Occupancies request
    • GET https://data.emergencyreporting.com/agencyoccupancies/occupancies
  2. Now that you have successfully returned account Occupancies, add ?expand=chemicals to the end of your request URL
    • GET https://data.emergencyreporting.com/agencyoccupancies/occupancies?expand=chemicals
  3. Send your GET request and notice that Occupancies that have a populated Chemical Inventory List as part of their Occupancy Prefire Plans will now show all associated Chemicals as well
        {
            "totalRows": "2",
            "occupancies": [
                {
                    "occupancyID": "12345xx",
                    ...
                    "occupancyChemicals": [
                        {
                            "rowNum": "1",
                            "occupancyID": "12345xx",
                            "occupancyChemicalInventoryID": "36851",
                            "occupancyChemicalListID": "2424",
                            "location": "Near North Wall",
                            "quantity": "1",
                            "containerType": "11",
                            "estimatedContainerCapacity": "50",
                            "capacityUnits": "12",
                            "notes": "It's Gasoline",
                            "archive": "0",
                            "rowVersion": "00000001A2345xxx",
                            "chemicalID": "11498",
                            "name": "GASOLINE"
                        },
                        {
                            "rowNum": "2",
                            "occupancyID": "12345xx",
                            "occupancyChemicalInventoryID": "36282",
                            "occupancyChemicalListID": "3166",
                            "location": "Near West Wall",
                            "quantity": "1",
                            "containerType": "12",
                            "estimatedContainerCapacity": "5",
                            "capacityUnits": "12",
                            "notes": "It’s Propane",
                            "archive": "0",
                            "rowVersion": "00000001B2346xxx",
                            "chemicalID": "18101",
                            "name": "1,1-DICHLORO-1,2,2,3,3-PENTAFLUOROPROPANE"
                        }
                    ]
                },
                ...
            ]
        }
    

Back to Top