PUT operations using attioFetch() on the server
Hi folks,
A bunch of assert operations for the Standard objects require a PUT operation, but the attioFetch() doc mentions that PUT is not in the allowed operations list. Why is this foundational functionality of assert/upsert missing for core objects from attioFetch(). Or I getting it wrong? :)
Summary from my coding agent below in the context of Person object creation and List insertion/assertion of a Person object without duplication of Entry IDs.
The issue is that attioFetch() does not support the PUT method, which is required for both assert endpoints:
Looking at the attioFetch signature from the SDK:
interface FetchAttioOptions {
method: "GET" | "POST" | "DELETE" | "PATCH"; // ← No PUT!
path: Path;
queryParams?: Record<string, unknown>;
body?: {
data?: Record<string, unknown>;
filter?: Record<string, unknown>;
};
}
Both assert endpoints we need require PUT:
Assert a person record: PUT /v2/objects/people/records?matching_attribute=email_addresses
Assert a list entry: PUT /v2/lists/{list}/entries
Since attioFetch() only supports GET | POST | DELETE | PATCH, we have to use native fetch() with ATTIO_API_TOKEN for authentication to call these PUT endpoints.
There's no way to use attioFetch() for PUT operations - it's a limitation of the current Attio SDK. The alternative would be to go back to the less efficient approach (POST to create, catch error, then query to find), but the assert operations are the correct API pattern to prevent duplicates.