I need to handle failed items and initiate recover...
# permit-saas
y
I need to handle failed items and initiate recovery options for bulk operations. using bulk endpoint what happens if one of the operations in bulk fails. will the bulk operation fails or only that single item. what response will be. is there any option to make the whole operation fail if a single item fails.
a
Hi @Yilmaz Alizadeh, I'm an AI assistant for Permit.io. I'll analyze available sources and get back to you shortly.
Based on the available documentation, when you perform bulk operations in Permit.io, the operations return a bulk operation result that includes details about which operations succeeded and which failed (1) (2) (3) . Looking at the Python SDK implementation, bulk operations return specific result objects like
UserCreateBulkOperationResult
,
UserReplaceBulkOperationResult
,
UserDeleteBulkOperationResult
, and
ResourceInstanceCreateBulkOperationResult
(2) (3) . These result objects contain information about the outcome of each individual operation within the bulk request.
Copy code
async def bulk_create(self, users: List[UserCreate]) -> UserCreateBulkOperationResult:
(3)
Copy code
async def bulk_replace(self, users: List[UserCreate]) -> UserReplaceBulkOperationResult:
Copy code
async def bulk_delete(self, users: List[str]) -> UserDeleteBulkOperationResult:
The bulk operations are currently limited to 1000 items per call (1) . However, the documentation doesn't specify the exact structure of the response objects or whether there's an option to make the entire operation fail if a single item fails. For handling failed items and recovery options, I don't have specific information about: • The exact response structure showing which items succeeded vs failed • Whether there's a configuration option for atomic/all-or-nothing bulk operations • Built-in recovery mechanisms for failed items I'd recommend reaching out to Email for more details on bulk operation failure handling and recovery strategies, as this specific behavior isn't detailed in the available documentation.
a
Hi @Yilmaz Alizadeh, thanks for reaching out! I’m looping in the team so I can provide you with a more complete answer.
@Yilmaz Alizadeh Our bulk APIs are generally atomic, so if one operation fails, the entire request fails. You can check the HTTP status code to know if it succeeded. However, for bulk endpoints, a 409 Conflict is usually ignored—meaning the bulk operation will complete successfully, and the conflicting items will be skipped. Some endpoints, like bulk create role assignments, also have flags (e.g.,
missing_user_policy
) to handle edge cases, but by default there’s no option for partial success.
🙌 1
y
thanks @Alon Boshi. this was very helpful.
💜 1