fastify-xwhatconverts
accounts.get
Fetch a single WhatConverts account by ID. Requires Agency Key.
accounts.get
Fetch a single account by its WhatConverts ID. Requires an Agency (Master) API Key.
Signature
fastify.xwhatconverts.accounts.get(accountId: string): Promise<object>
Params
| Name | Type | Required | Description |
|---|---|---|---|
accountId | string | Yes | The WhatConverts account ID. |
Returns
A WhatConverts account object.
Throws
[xWhatConverts] accounts.get: accountId is required— called withoutaccountId.[xWhatConverts] Network error: <message>— network-level failure.[xWhatConverts] API error: <status>— non-2xx response;404if account not found.
Examples
Basic — fetch an account
const account = await fastify.xwhatconverts.accounts.get("555");
console.log(account.account_name);
Realistic — verify account exists before creating a profile
fastify.post("/setup/:accountId/profile", async (request, reply) => {
const account = await fastify.xwhatconverts.accounts.get(request.params.accountId);
const profile = await fastify.xwhatconverts.profiles.create({
accountId: account.account_id,
profileName: `${account.account_name} — Main`,
profileUrl: request.body.siteUrl,
});
return { profileId: profile.profile_id };
});
See Also
- accounts.list — list all accounts
- accounts.update — update an account
AI Context
package: "@xenterprises/fastify-xwhatconverts"
method: fastify.xwhatconverts.accounts.get(accountId)
use-when: Fetch a single WhatConverts account by ID
params: accountId (string, required)
returns: WhatConverts account object
