Step-by-step guides
Proxy requests an API
Step-by-step guide on how to proxy requests to an API (using the proxy).
Pre-requisite: creation of an integration and at least one connection (step-by-step guide).
The Proxy lets you query external APIs easily with credentials injection, request logging, and pre-configurations for base URLs, rate-limits, retries, etc.
Here is an example of how to query external APIs with the proxy, using the SDK (reference) and API (reference):
try {
const res = await nango.proxy({
method: 'POST',
baseUrlOverride: 'https://api.example.com',
endpoint: '/external-endpoint',
providerConfigKey: '<string>',
connectionId: '<string>',
retries: 5, // Retries with exponential backoff (optional, default 0)
data: {
id: 1,
colorId: 'blue',
selected: true
}
});
// Response was 200!
// See https://axios-http.com/docs/res_schema
console.log(res.data);
} catch (error) {
// Status of response != 200
// See https://axios-http.com/docs/handling_errors
console.log(error.response.data);
console.log(error.response.status);
console.log(error.response.headers);
}
Questions, problems, feedback? Please reach out in the Slack community.
Was this page helpful?