Wrapper over fetch for performing common operations when executing a request to an OGC API, such as:
- Creating the query string
- URL encoding query string values
- Appending the ?target query param if needed
- Checking whether the response is ok
- Returning the .json() of the response body
Note: the ?target query param is only appended if the target site (options.site) is different from the the site that will have its OGC API hit (url). This allows us to use the environment-level OGC API's url while actually targeting a specific Hub Site's catalog. It's a powerful capability that significantly eases local development.
We omit the ?target query when the site and url are the same because it would be redundant.
Bad example: https://hubqa.arcgis.com/api/search/v1?target="hubqa.arcgis.com" Good example: https://hubqa.arcgis.com/api/search/v1
the OGC API endpoint that should actually be hit
query params that should be serialized with the request (excluding
options to customize the search, such as the site whose catalogs we're targeting
the JSON response from the endpoint
Function defined in common/src/search/_internal/hubSearchItemsHelpers/ogcApiRequest.ts:30