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 deleteObjectsByExternalId
method allows you to bulk delete multiple entities from the
Teamwork Graph using their external IDs and object type. This is useful for removing entities in
batches when you know their external identifiers.
1 2deleteObjectsByExternalId(request: DeleteObjectsByExternalIdRequest): Promise<DeleteObjectsByExternalIdResponse>
DeleteObjectsByExternalIdRequest
1 2// DeleteObjectsByExternalIdRequest object: { objectType: string; // objectType: The type of object to delete (e.g., 'atlassian:document', 'atlassian:message') externalIds: string[]; // externalIds: Array of external identifiers of entities to delete }
1 2import { graph } from '@forge/teamwork-graph'; const request = { objectType: 'atlassian:document', externalIds: ['pipelines/123/builds/456', 'pipelines/123/builds/789'] }; const response = await graph.deleteObjectsByExternalId(request); if (response.success) { console.log('Deletion success'); } else { console.error('Error deleting entities:', response.error); }
1 2// Delete document entities const documentRequest = { objectType: 'atlassian:document', externalIds: ['api-doc-1', 'api-doc-2', 'api-doc-3'] }; const documentResponse = await graph.deleteObjectsByExternalId(documentRequest); // Delete message entities const messageRequest = { objectType: 'atlassian:message', externalIds: ['msg-1', 'msg-2', 'msg-3'] }; const messageResponse = await graph.deleteObjectsByExternalId(messageRequest);
1 2const request = { objectType: 'atlassian:document', externalIds: ['doc-1', 'doc-2', 'doc-3', 'doc-4'] }; const response = await graph.deleteObjectsByExternalId(request); if (response.success) { console.log('All objects deleted successfully'); } else { console.error('Deletion failed:', response.error); if (response.originalError) { console.error('Original error:', response.originalError); } }
The method validates the following:
objectType
field must be a non-empty string.externalIds
field must be a valid array.externalIds
array cannot be empty.Error message | Description |
---|---|
objectType is required | The objectType is missing or empty. |
externalIds must be an array | The externalIds field is not an array. |
externalIds array cannot be empty | The externalIds array is empty. |
Bulk object deletion supports maximum 100 entities | The number of external IDs per request has exceeded the maximum limit. |
Failed to delete entities by external ID | The API request failed. |
The method returns a promise that resolves to a DeleteEntitiesByExternalIdResponse
object.
1 2// DeleteObjectsByExternalIdResponse { success: boolean; // Indicates if the overall operation was successful 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.DeleteObjectsByExternalIdRequest = { objectType: 'atlassian:document', externalIds: ['doc-1', 'doc-2', 'doc-3'] }; // TypeScript will enforce the correct structure const response = await graph.deleteObjectsByExternalId(request); // Type-safe response handling if (response.success) { // TypeScript knows success is true here console.log('Deletion completed successfully'); } else { // TypeScript knows error exists here console.error('Deletion failed:', response.error); // Safely access originalError if available if (response.originalError) { console.error('Original error details:', response.originalError); } }
The type system ensures:
request.objectType
must be a stringrequest.externalIds
must be a string arrayresponse.success
is always a booleanresponse.error
and response.originalError
are properly typed when presentRate this page: