The Connector SDK APIs are available through Forge's Early Access Program (EAP).
EAPs are offered to selected users for testing and feedback purposes. APIs and features under EAP are unsupported and subject to change without notice. APIs and features under EAP are not recommended for use in production environments.
To use the Connector SDK, you must be part of the Forge connector EAP. You can express interest in joining this EAP through this form.
The deleteUsersByExternalId
method allows you to bulk delete multiple users from the Teamwork Graph
using their external IDs. This is useful for removing users in batches when you know their external identifiers.
1 2deleteUsersByExternalId(request: DeleteUsersByExternalIdRequest): Promise<DeleteUsersByExternalIdResponse>
DeleteUsersByExternalIdRequest
1 2// DeleteUsersByExternalIdRequest object: { externalIds: string[]; // externalIds: Array of external identifiers of users to delete }
1 2import { graph } from '@forge/teamwork-graph'; const request = { externalIds: ['user-123', 'user-456'] }; const response = await graph.deleteUsersByExternalId(request); if (response.success) { console.log('Deletion results:', response.results); } else { console.error('Error deleting users:', response.error); }
1 2const request = { externalIds: ['user-1', 'user-2', 'user-3', 'user-4'] }; const response = await graph.deleteUsersByExternalId(request); if (response.success && response.results) { response.results.forEach(result => { if (result.success) { console.log(`Successfully deleted user: ${result.externalId}`); } else { console.error(`Failed to delete user ${result.externalId}: ${result.error}`); } }); }
The method validates the following:
externalIds
field must be a valid array.externalIds
array cannot be empty.externalIds
per request.Error message | Description |
---|---|
externalIds must be an array | The externalIds field is not an array. |
externalIds array cannot be empty | The externalIds array is empty. |
Failed to delete users by external ID | The API request failed. |
The method returns a promise that resolves to a DeleteUsersByExternalIdResponse
object.
1 2// DeleteUsersByExternalIdResponse { success: boolean; // Indicates if the overall operation was successful results?: Array<{ // Individual results for each external ID externalId: string; // The external ID that was processed message?: string; statusCode: number; }>; error?: string; // Overall error message (if operation failed) originalError?: unknown; // Original error object (if available) }
The SDK provides type-safe request and response objects that ensure compile-time validation:
1 2import { types } from '@forge/teamwork-graph'; // Type-safe request creation const request: types.DeleteUsersByExternalIdRequest = { externalIds: ['user-123', 'user-456'] }; // Type-safe response handling const response = await graph.deleteUsersByExternalId(request); if (response.success && response.results) { // TypeScript knows results exists here response.results.forEach(result => { // result is properly typed with externalId, message, statusCode, and success if (result.success) { console.log(`Successfully deleted user: ${result.externalId}`); // TypeScript knows statusCode exists console.log(`Status: ${result.statusCode}`); } else { console.error(`Failed to delete user ${result.externalId}`); // TypeScript knows message exists if (result.message) { console.error(`Message: ${result.message}`); } } }); }
The type system ensures:
request.externalIds
must be a string arrayresponse.results
is properly typed as an array when success
is trueexternalId
, message
, statusCode
, and success
propertiesRate this page: