type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* Create Many Memberships
* This endpoint returns a `job_status` JSON object and queues a background job to do the work. Use the Show Job Status endpoint to check for the job's completion. Only a certain number of jobs can be queued or running at the same time. See Job limit for more information.
#### Allowed For
* Admins
* Agents
*/
export async function main(auth: Zendesk) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/organization_memberships/create_many`
);
const response = await fetch(url, {
method: "POST",
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 298 days ago
type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* Create Many Memberships
* This endpoint returns a `job_status` JSON object and queues a background job to do the work. Use the Show Job Status endpoint to check for the job's completion. Only a certain number of jobs can be queued or running at the same time. See Job limit for more information.
#### Allowed For
* Admins
* Agents
*/
export async function main(auth: Zendesk) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/organization_memberships/create_many`
);
const response = await fetch(url, {
method: "POST",
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 844 days ago