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 deleteObjectsByProperties
method allows you to delete entities from the Teamwork Graph based
on specific property criteria. This is useful for removing entities that match certain conditions
rather than knowing their exact external IDs.
1 2deleteObjectsByProperties(request: DeleteObjectsByPropertiesRequest): Promise<DeleteObjectsByPropertiesResponse>
DeleteObjectsByPropertiesRequest
1 2// DeleteObjectsByPropertiesRequest object: Record<string, string> // A properties object containing key-value pairs for deletion criteria
1 2import { graph } from '@forge/teamwork-graph'; const request = { environment: 'staging' }; const response = await graph.deleteObjectsByProperties(request); if (response.success) { console.log('Deletion completed successfully'); } else { console.error('Error deleting entities:', response.error); }
For EAP, deleteObjectsByProperties supports only 1 key-value pair as shown in the above example.
1 2const request = { environment: 'staging' }; const response = await graph.deleteObjectsByProperties(request); if (response.success) { console.log('All matching entities deleted successfully'); } else { console.error('Deletion failed:', response.error); if (response.originalError) { console.error('Original error:', response.originalError); } }
Only one property
per request.
The method validates the following:
property
object must only contain one property criteria for deletion.Error message | Description |
---|---|
properties must be an object | The request is not an object. |
properties object cannot be empty | The properties object is empty. |
Property-based deletion failed | The overall operation failed. |
The method returns a promise that resolves to a DeleteObjectsByPropertiesResponse
object.
1 2// DeleteObjectsByPropertiesResponse { 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 responses that ensure compile-time validation:
1 2import { types } from '@forge/teamwork-graph'; // Type-safe request creation const request: types.DeleteObjectsByPropertiesRequest = { environment: 'staging' }; const response = await graph.deleteObjectsByProperties(request); if (response.success) { // TypeScript knows success is true here console.log('All matching entities deleted 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
must be a valid object with string key-value pairsresponse.success
is always a booleanresponse.error
and response.originalError
are properly typed when presentRate this page: