Skip to Content

Create or replace addressbook object.

Creates or updates a addressbook object from raw text/vcard text or JSContact JSON (RFC 9553).

openemail.addressbookObjects.put(
  identityId: string,
  addressbookId: string,
  href: string,
  vcard: RawBody,
  options?: AddressbookObjectsPutOptions,
): ApiPromise<PimPutResult>

It calls PUT /identities/{identityId}/addressbooks/{addressbookId}/objects/{href}: Create or replace addressbook object in the API reference.

Example

const pimPutResult = await openemail.addressbookObjects.put(identityId, addressbookId, href, vcard)

Arguments

ArgumentTypeDescription
identityIdstringMailbox identity ULID. The path's {identityId}.
addressbookIdstringCollection ULID or its name slug. The path's {addressbookId}.
hrefstringThe object's href: its filename segment within the collection (e.g. 1a2b3c.ics). The path's {href}.
vcardRawBodyRaw iCalendar or vCard text. The request's body, as bytes: text, a Blob, an ArrayBuffer or a Uint8Array (raw bodies).

Options

The last argument, options, a AddressbookObjectsPutOptions, takes:

OptionTypeSent asDescription
ifMatchstringheader if-matchMatch target ETag for optimistic concurrency
ifScheduleTagMatchstringheader if-schedule-tag-matchRFC 6638 §3.2.10.1 — match the target's Schedule-Tag. Unlike the ETag this does not move when an arriving REPLY patches PARTSTAT into the stored copy, so an organizer's client can still write conditionally after its attendees answer. Sent together with If-Match, BOTH must validate
ifNoneMatchstringheader if-none-matchSet to '*' to only create if resource does not exist

Every call also takes signal, timeout, retry and headers, which say how that one call is sent (call options).

Answer

Awaited, it is the API's JSON, PimPutResult. It is an ApiPromise: .withResponse() gives the same with the Response it came in, for its headers.

Errors

StatusWhat it means
400empty_body, invalid_href, multiple_uids, unsatisfiable_recurrence (an RRULE no date after DTSTART satisfies), or validation error
401unauthorized: the bearer credential is missing, malformed, expired, or revoked. Carries a WWW-Authenticate: Bearer challenge
403forbidden: read-only grant
404No such collection, or mailbox not accessible
409uid_conflict: the href holds a different UID, or the UID already lives at another href (conflictHref names it); unsupported_component: the calendar does not accept the object's component
412precondition_failed: If-Match/If-None-Match not satisfied
413object_too_large (max 1048576 bytes)
503scheduling_unavailable: preparation could not complete; no mutation committed. Or temporary_failure: the platform's storage could not answer just now; retry after the Retry-After window. Any operation can answer this. A write that got it may have been applied, so retry it with the same idempotency key where it takes one, or read the state back first (see Transient failures in the API description)
507scheduling_backlog_full, too_many_objects (collection or store object cap) or store_full (the store's 268435456-byte total would be exceeded)

A failed call rejects with a RequestError: its status, and its code, the API's error. Decide on the code: one status covers several.

Types

It names these types of the API, each on a page of its own: PimPutResult.