node-zendesk • Docs
node-zendesk / clients/core/organizations / Organizations
Class: Organizations
Client for interacting with the Zendesk Organizations API.
See
https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/
Extends
Constructors
new Organizations()
new Organizations(
options
):Organizations
Parameters
• options: any
Returns
Overrides
Defined in
clients/core/organizations.d.ts:7
Properties
_transporter
_transporter:
Transporter
Inherited from
Defined in
clients/client.d.ts:42
eventTarget
eventTarget:
CustomEventTarget
Event target to handle custom events.
Inherited from
Defined in
clients/client.d.ts:40
jsonAPINames
jsonAPINames:
string
[]
Array to hold names used in the JSON API.
Overrides
Defined in
clients/core/organizations.d.ts:8
options
options:
ZendeskClientOptions
&object
Configuration options for the client.
Type declaration
get()
get: (
key
) =>any
Parameters
• key: string
Returns
any
Inherited from
Defined in
clients/client.d.ts:34
sideLoad
sideLoad:
any
[]
Array to handle side-loaded resources.
Inherited from
Defined in
clients/client.d.ts:37
useDotJson
useDotJson:
boolean
Flag to indicate if the API endpoint should use '.json' ending.
Inherited from
Defined in
clients/client.d.ts:39
Accessors
transporter
Get Signature
get transporter():
Transporter
Returns
Transporter for making requests.
Inherited from
Defined in
clients/client.d.ts:41
Methods
_rawRequest()
_rawRequest(
method
,uri
, ...arguments_
):Promise
<object
>
Parameters
• method: any
• uri: any
• ...arguments_: any
[]
Returns
Promise
<object
>
response
response:
any
result
result:
object
Inherited from
Defined in
clients/client.d.ts:78
autocomplete()
autocomplete(
parameters
):Promise
<object
[]>
Autocompletes organization names based on provided parameters.
Parameters
• parameters: object
Parameters for autocomplete.
Returns
Promise
<object
[]>
List of organizations matching the autocomplete.
See
Example
const autocompleteResults = await client.organizations.autocomplete({ name: 'Test' });
Defined in
clients/core/organizations.d.ts:186
bulkDelete()
bulkDelete(
organizationIds
):Promise
<object
>
Deletes multiple organizations based on their IDs.
Parameters
• organizationIds: number
[]
Array of organization IDs.
Returns
Promise
<object
>
Returns a job status JSON object.
Throws
Throws an error if deletion fails.
See
Example
await client.organizations.bulkDelete([12345, 67890]);
Defined in
clients/core/organizations.d.ts:161
bulkDeleteByExternalId()
bulkDeleteByExternalId(
organizationExternalIds
):Promise
<object
>
Deletes multiple organizations based on their external IDs.
Parameters
• organizationExternalIds: string
[]
Array of organization external IDs.
Returns
Promise
<object
>
Returns a job status JSON object.
Throws
Throws an error if deletion fails.
See
Example
await client.organizations.bulkDeleteByExternalId(['ext-12345', 'ext-67890']);
Defined in
clients/core/organizations.d.ts:170
count()
count():
Promise
<number
>
Counts the number of organizations.
Returns
Promise
<number
>
Number of organizations.
See
Example
const orgCount = await client.organizations.count();
Defined in
clients/core/organizations.d.ts:30
countByUser()
countByUser(
userID
):Promise
<number
>
Counts the number of organizations associated with a specific user.
Parameters
• userID: number
The ID of the user.
Returns
Promise
<number
>
Number of organizations associated with the user.
See
Example
const userOrgCount = await client.organizations.countByUser(12345);
Defined in
clients/core/organizations.d.ts:38
create()
create(
organization
):Promise
<object
>
Creates a new organization.
Parameters
• organization: object
The organization object to create.
Returns
Promise
<object
>
The created organization's details.
response
response:
object
result
result:
object
See
Example
const newOrganization = await client.organizations.create({ name: 'New Org' });
Defined in
clients/core/organizations.d.ts:84
createMany()
createMany(
organizations
):Promise
<object
>
Creates multiple organizations.
Parameters
• organizations: object
[]
An array of organization objects to create.
Returns
Promise
<object
>
Details of the created organizations.
response
response:
object
result
result:
object
[]
See
Example
const newOrganizations = await client.organizations.createMany([{ name: 'Org1' }, { name: 'Org2' }]);
Defined in
clients/core/organizations.d.ts:95
createOrUpdate()
createOrUpdate(
organization
):Promise
<object
>
Creates or updates an organization.
Parameters
• organization: object
The organization object to create or update.
Returns
Promise
<object
>
The created or updated organization's details.
response
response:
object
result
result:
object
See
Example
const org = await client.organizations.createOrUpdate({ id: 12345, name: 'Updated Name' });
Defined in
clients/core/organizations.d.ts:106
delete()
delete(
organizationID
):Promise
<void
>
Deletes a specific organization by its ID.
Parameters
• organizationID: number
The ID of the organization to delete.
Returns
Promise
<void
>
Throws
Throws an error if deletion fails.
See
Example
await client.organizations.delete(12345);
Overrides
Defined in
clients/core/organizations.d.ts:152
emit()
emit(
eventType
,eventData
):void
Parameters
• eventType: any
• eventData: any
Returns
void
Inherited from
Defined in
clients/client.d.ts:43
get()
get(
resource
):Promise
<NodeModule
>
Parameters
• resource: any
Returns
Promise
<NodeModule
>
Inherited from
Defined in
clients/client.d.ts:62
getAll()
getAll(
resource
):Promise
<any
[]>
Parameters
• resource: any
Returns
Promise
<any
[]>
Inherited from
Defined in
clients/client.d.ts:77
incremental()
incremental(
startTime
):Promise
<object
[]>
Incrementally exports organizations.
Parameters
• startTime: string
| Date
Start time for incremental export.
Returns
Promise
<object
[]>
List of organizations in the incremental export.
See
Example
const exportedOrganizations = await client.organizations.incremental('2023-01-01T12:00:00Z');
Defined in
clients/core/organizations.d.ts:203
incrementalInclude()
incrementalInclude(
startTime
,include
):Promise
<object
[]>
Incrementally exports organizations with an include parameter.
Parameters
• startTime: string
| Date
Start time for incremental export.
• include: string
Data to include in the export.
Returns
Promise
<object
[]>
List of organizations in the incremental export.
See
Example
const exportedOrganizations = await client.organizations.incrementalInclude('2023-01-01T12:00:00Z', 'users');
Defined in
clients/core/organizations.d.ts:195
incrementalSample()
incrementalSample(
startTime
):Promise
<object
>
Fetches a sample of incremental organization exports.
Parameters
• startTime: string
| Date
Start time for the sample.
Returns
Promise
<object
>
Sample list of organizations in the incremental export.
response
response:
object
result
result:
object
[]
See
Example
const sampleExportedOrganizations = await client.organizations.incrementalSample('2023-01-01T12:00:00Z');
Defined in
clients/core/organizations.d.ts:211
list()
list():
Promise
<object
>
Lists all organizations.
Returns
Promise
<object
>
The list of organizations.
See
Example
const organizations = await client.organizations.list();
Defined in
clients/core/organizations.d.ts:15
listByUser()
listByUser(
userID
):Promise
<object
[]>
Lists organizations associated with a specific user.
Parameters
• userID: number
The ID of the user.
Returns
Promise
<object
[]>
List of organizations associated with the user.
See
Example
const userOrgs = await client.organizations.listByUser(12345);
Defined in
clients/core/organizations.d.ts:23
on()
on(
eventType
,callback
):void
Parameters
• eventType: any
• callback: any
Returns
void
Inherited from
Defined in
clients/client.d.ts:44
patch()
patch(...
arguments_
):Promise
<void
|object
>
Patches a resource.
Parameters
• ...arguments_: any
[]
The resources or parts of the resource path followed by the body.
Returns
Promise
<void
| object
>
- Either void or response object
Inherited from
Defined in
clients/client.d.ts:68
post()
post(
resource
,body
):Promise
<NodeModule
>
Parameters
• resource: any
• body: any
Returns
Promise
<NodeModule
>
Inherited from
Defined in
clients/client.d.ts:70
put()
put(
resource
,body
):Promise
<NodeModule
>
Parameters
• resource: any
• body: any
Returns
Promise
<NodeModule
>
Inherited from
Defined in
clients/client.d.ts:69
related()
related(
organizationID
):Promise
<object
>
Retrieves related information for a specific organization.
Parameters
• organizationID: number
The ID of the organization.
Returns
Promise
<object
>
Object containing related information of the organization.
response
response:
object
result
result:
object
See
Example
const relatedInfo = await client.organizations.related(12345);
Defined in
clients/core/organizations.d.ts:46
request()
request<
T
>(method
,uri
, ...arguments_
):Promise
<NodeModule
>
Request method that handles various HTTP methods.
Type Parameters
• T
Parameters
• method: string
HTTP method (e.g., 'GET', 'POST').
• uri: string
The URI for the request.
• ...arguments_: any
[]
Additional arguments for the request.
Returns
Promise
<NodeModule
>
- The API response.
Inherited from
Defined in
clients/client.d.ts:96
requestAll()
requestAll(
method
,uri
, ...arguments_
):Promise
<any
[]>
Parameters
• method: any
• uri: any
• ...arguments_: any
[]
Returns
Promise
<any
[]>
Inherited from
Defined in
clients/client.d.ts:97
requestUpload()
requestUpload(
uri
,file
):Promise
<any
>
Parameters
• uri: any
• file: any
Returns
Promise
<any
>
Inherited from
Defined in
clients/client.d.ts:98
search()
search(
externalID
):Promise
<object
[]>
Searches organizations based on external ID.
Parameters
• externalID: number
Search by externalID.
Returns
Promise
<object
[]>
List of organizations matching the search.
See
Example
const foundOrganizations = await client.organizations.search(1234);
Defined in
clients/core/organizations.d.ts:178
setSideLoad()
setSideLoad(
array
):void
Parameters
• array: any
Returns
void
Inherited from
Defined in
clients/client.d.ts:61
show()
show(
organizationID
):Promise
<object
>
Views a specific organization by its ID.
Parameters
• organizationID: number
The ID of the organization.
Returns
Promise
<object
>
The organization's details.
response
response:
object
result
result:
object
See
https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#show-organization
Example
const organization = await client.organizations.show(12345);
Defined in
clients/core/organizations.d.ts:57
showMany()
showMany(
organizationIDs
):Promise
<object
[]>
Retrieves details of multiple organizations based on their IDs.
Parameters
• organizationIDs: number
[]
Array of organization IDs.
Returns
Promise
<object
[]>
List of organizations' details.
See
Example
const orgDetails = await client.organizations.showMany([12345, 67890]);
Defined in
clients/core/organizations.d.ts:68
showManyByExternalIds()
showManyByExternalIds(
externalOrganizationIds
):Promise
<object
[]>
Retrieves details of multiple organizations based on their External IDs.
Parameters
• externalOrganizationIds: string
[]
Array of organization IDs.
Returns
Promise
<object
[]>
List of organizations' details.
See
Example
const orgDetails = await client.organizations.showMany(['12345', '67890']);
Defined in
clients/core/organizations.d.ts:76
update()
update(
organizationID
,organization
):Promise
<object
>
Updates a specific organization by its ID.
Parameters
• organizationID: number
The ID of the organization.
• organization: object
The updated organization object.
Returns
Promise
<object
>
The updated organization's details.
response
response:
object
result
result:
object
See
Example
const updatedOrganization = await client.organizations.update(12345, { name: 'New Name' });
Defined in
clients/core/organizations.d.ts:118
updateMany()
updateMany(
organizations
):Promise
<object
>
Updates multiple organizations.
Parameters
• organizations: object
[]
An array of organization objects to update.
Returns
Promise
<object
>
Details of the updated organizations.
response
response:
object
result
result:
object
[]
See
Example
const updatedOrganizations = await client.organizations.updateMany([{ id: 1, name: 'Updated Org1' }, { id: 2, name: 'Updated Org2' }]);
Defined in
clients/core/organizations.d.ts:129
upsert()
upsert(
organization
):Promise
<object
>
Creates or updates an organization, similar to createOrUpdate
method.
Parameters
• organization: object
The organization object to upsert.
Returns
Promise
<object
>
The created or updated organization's details.
response
response:
object
result
result:
object
See
Example
const org = await client.organizations.upsert({ id: 12345, name: 'Upserted Name' });
Defined in
clients/core/organizations.d.ts:140