Proxying a public API
Your API might not always run on your local machine, it could be a public API. Inspectr can still capture and replay requests by forwarding them to that public API.
We’ll use Open Brewery DB, a public dataset of craft breweries. (If you are looking for some public API to experiment with have look at https://mixedanalytics.com/blog/list-actually-free-open-no-auth-needed-apis/).

For more details on available endpoints, see the Open Brewery DB documentation
Step 1: Verify Access to the Remote API
Section titled “Step 1: Verify Access to the Remote API”Make sure you can reach the remote backend from your current machine.
curl "https://api.openbrewerydb.org"
results in
{ "message": "Welcome to the Breweries API, see the documentation at https://www.openbrewerydb.org/documentation"}
Step 2: Start Inspectr
Section titled “Step 2: Start Inspectr”Run Inspectr locally and point it at the remote API using the --backend
flag:
inspectr --listen=:8080 --backend=https://api.openbrewerydb.org
- Inspectr listens on
:8080
. - Incoming requests are forwarded to
https://api.openbrewerydb.org
. - Request and response details appear in the console and at http://localhost:4004.
Step 3: Send Requests Through Inspectr
Section titled “Step 3: Send Requests Through Inspectr”Update your client or tools to use the local Inspectr address:
curl "http://localhost:8080/v1/breweries"
results in:
[ { "id": "5128df48-79fc-4f0f-8b52-d06be54d0cec", "name": "(405) Brewing Co", "brewery_type": "micro", "address_1": "1716 Topeka St", "address_2": null, "address_3": null, "city": "Norman", "state_province": "Oklahoma", "postal_code": "73069-8224", "country": "United States", "longitude": -97.46818222, "latitude": 35.25738891, "phone": "4058160490", "website_url": "http://www.405brewing.com", "state": "Oklahoma", "street": "1716 Topeka St" }, ...]
Inspectr forwards the request to the remote backend and displays the response.

Troubleshooting
Section titled “Troubleshooting”When the remote backend is not available or the request cannot be delivered, Inspectr will return a 502
HTTP status with a response:
{ "error": "Inspectr backend unavailable. Unable to connect to the backend service. Please ensure the service is running.", "code": 502}
In the Inspectr, you will see a request with the status N/A

Summary
Section titled “Summary”Using Inspectr with a remote backend lets you debug staging or production APIs with the same tools you use locally. Point Inspectr at any public API, send traffic through it, and replay requests when needed.