A shipping provider is changing its API, and you want to know which parts of your application depend on it. Use a small client to explore what Duo can explain from the code and what still needs checking with the provider.
Give Duo the client code
Copy this sample into your conversation, then use the original prompt with [SERVICE/API] replaced by the shipping provider. The code is for reading; you don't need credentials or a running service to discuss it.
/**
* Read a shipment's status for the tracking page.
* Accepts a shipment ID and a configured API base URL. Makes a GET request,
* retries once on HTTP 503, and returns the response's status field.
* Network, HTTP, and JSON errors propagate to the caller.
*/
async function shipmentStatus(baseUrl, shipmentId) {
const url = `${baseUrl}/v1/shipments/${encodeURIComponent(shipmentId)}`;
let response = await fetch(url);
if (response.status === 503) response = await fetch(url);
if (!response.ok) throw new Error(`Tracking failed: ${response.status}`);
const shipment = await response.json();
return shipment.status;
}
/**
* Request a label only when label purchasing is enabled.
* Accepts an order with id and address fields, a base URL, and an explicit
* enabled flag. Returns null without a request when disabled; otherwise sends
* one POST and returns label_url. Errors propagate; purchases aren't retried.
*/
async function purchaseLabel(baseUrl, order, enabled) {
if (!enabled) return null;
const response = await fetch(`${baseUrl}/v1/labels`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ order_id: order.id, address: order.address }),
});
if (!response.ok)
throw new Error(`Label purchase failed: ${response.status}`);
const label = await response.json();
return label.label_url;
}
Compare the answer with the code
You should be able to connect each part of Duo's explanation to a line in the client. This illustrative comparison summarizes the details to look for in your response:
| Request | Data sent and used | Behavior worth noticing |
|---|---|---|
GET /v1/shipments/{shipmentId} |
The encoded shipment ID goes in the path; the client reads status from the JSON response. |
A 503 causes one retry. Other unsuccessful responses throw an error. |
POST /v1/labels |
The JSON body contains order_id and address; the client reads label_url from the response. |
The request happens only when enabled is true. It isn't retried. |
The client doesn't show the provider's full response, authentication requirements, or which values status can contain. If Duo fills those gaps with guesses, ask it to identify what you'd need to look up. You can use the explanation to plan your compatibility checks, which will also need information about the provider's proposed change.
Add the application's configuration
For a follow-up, tell Duo:
Label purchasing is disabled in this deployment. The tracking page still calls
shipmentStatus. Which request is active, and which code would we need to revisit
if we enabled label purchasing?
Look for an explanation of how the configuration affects each request. Tracking still uses the shipment endpoint, while a call to purchaseLabel with enabled set to false returns before sending a request.
Investigate a proposed change
Suppose the provider proposes replacing status with state. Ask Duo where that change would affect this client and what you'd want to test. It should point to the value returned by shipmentStatus: if the response no longer includes status, the function returns undefined even when the HTTP request succeeds.
That gives you a concrete next step: check how the tracking page handles the returned value and test it against the proposed response. You'd still want the provider's actual API documentation before deciding whether the change applies to your integration.