Retrieve All Inspections from an org
Number of APIs: 3
Three requests and a for loop are required to retrieve inspection data for an entire org. In order for this collection to work, an org_id must be provided, either as a environment variable set in the Qodex environment, or as a collection variable in the pre-request script of the second request (there is a commented example).
The first request is to retrieve the bearer token necessary for authentication. This is a common theme and it is generally best practice to call this once for a session and store the result as an environment variable. We do just that in the post-response scripts for this request.
The second request is GET Solar Farm Data. In this flow we'll use post-request scripts to create a list of farm UUIDs from the farms returned and then save that as an environment variable so we can retrieve the inspections for each farm.
The third and final request is GET Solar Inspection Data. In this flow, we run through this iteratively using the list of UUIDs retrieved from the second request. This will return a list of inspections associated with the specified farm. As a convenience, we log out the names of the inspections from each request as an example for how to interact with the data.
-
Retrieve Bearer Token POST {{url}}/oauth/token
-
GET Solar Farm Data GET {{url}}/solar_farms?org_id={{org_id}}
-
GET Solar Inspection Data GET {{legacy_url}}/solar_farms/{{farm_uuid}}/solar_inspections?org_id={{org_id}}