type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* List Identities
* Returns a list of identities for the given user.
Use the first endpoint if authenticating as an agent. Use the second if authenticating as an end user. End users can only list email and phone number identities.
#### Pagination
* Cursor pagination (recommended)
* Offset pagination
See Pagination.
Returns a maximum of 100 records per page.
#### Allowed For
* Agents
* Verified end users
*/
export async function main(auth: Zendesk, user_id: string) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/users/${user_id}/identities`
);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 377 days ago
type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* List Identities
* Returns a list of identities for the given user.
Use the first endpoint if authenticating as an agent. Use the second if authenticating as an end user. End users can only list email and phone number identities.
#### Pagination
* Cursor pagination (recommended)
* Offset pagination
See Pagination.
Returns a maximum of 100 records per page.
#### Allowed For
* Agents
* Verified end users
*/
export async function main(auth: Zendesk, user_id: string) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/users/${user_id}/identities`
);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 923 days ago