Retrieve Defects from a single inspection

Number of APIs: 4

For this operation, we need to string together four requests to access the inspection defects. 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. If the bearer token has been retrieved earlier in process and stored, this request can be skipped.

The second request is GET Solar Farm Data. In this flow we'll use post-request scripts to pull the farm UUID from the first farm returned into the environment so we can retrieve a list of inspections associated with that farm.

The third request is GET Solar Inspection Data using the UUID retrieved from the second request. This will return a list of inspections associated with the specified farm.

We use the inspection ID from this third request to get the defects found in the specified inspection.

  1. Retrieve Bearer Token POST {{url}}/oauth/token

  2. GET Solar Farm Data GET {{url}}/solar_farms?org_id={{org_id}}

  3. GET Solar Inspection Data GET {{legacy_url}}/solar_farms/{{farm_uuid}}/solar_inspections?org_id={{org_id}}

  4. GET Defects by Inspection ID GET {{url}}/solar_inspections/{{inspection_id}}/defects?org_id={{org_id}}