Root API operations
- get - root
Retrieve the API root entry point to discover available resources and endpoints based on your OAuth access token permissions. Returns HAL+JSON with navigation links to accessible resources including accounts, customers, events, and webhook subscriptions depending on token scope. Essential for API exploration, dynamic resource discovery, and building adaptive client applications that respond to available permissions.
import { Dwolla } from "dwolla";
const dwolla = new Dwolla({
security: {
clientID: process.env["DWOLLA_CLIENT_ID"] ?? "",
clientSecret: process.env["DWOLLA_CLIENT_SECRET"] ?? "",
},
});
async function run() {
const result = await dwolla.root.get();
console.log(result);
}
run();The standalone function version of this method:
import { DwollaCore } from "dwolla/core.js";
import { rootGet } from "dwolla/funcs/rootGet.js";
// Use `DwollaCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dwolla = new DwollaCore({
security: {
clientID: process.env["DWOLLA_CLIENT_ID"] ?? "",
clientSecret: process.env["DWOLLA_CLIENT_SECRET"] ?? "",
},
});
async function run() {
const res = await rootGet(dwolla);
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("rootGet failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<models.Root>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.GetRootDwollaV1HalJSONError | 401 | application/vnd.dwolla.v1.hal+json |
| errors.APIError | 4XX, 5XX | */* |