Problem
cxone_sdk doesn’t expose a retry wrapper for suppression PATCH calls, so version conflicts break the atomic update. Python script pushes contact identifiers with reason codes and expiration dates.
- Python 3.11
requestslibrary - CXone
/cxonecc/suppression/v1/suppressionListsendpoint - Local deduplication and date normalization pipeline
- Optimistic locking via
If-Matchheader
Code
import requests
headers = {"Authorization": f"Bearer {tok}", "If-Match": ver, "Content-Type": "application/json"}
body = {"contacts": [{"identifier": "a@b.com", "reason": "compliance", "expires": "2024-12-31T00:00:00Z"}]}
requests.patch(f"https://api.nice.incontact.com/cxonecc/suppression/v1/suppressionLists/{lid}", headers=headers, json=body)
Error
HTTP 409 returns {"errorCode": "VERSION_CONFLICT", "message": "Optimistic locking failed."} since parallel CRM webhooks modify the list before the deduplication pipeline finishes.
Question
How do I refresh the If-Match token without fetching the full suppression array?