Create a distribution list
const url = 'https://calendar.work.optidata.cloud/api/groups/distribution-list';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"email":"engineering@acme.example","users":[{"uuid":"9e926fb1-e1ff-4fc9-81a1-5740f10ba57f","email":"jane.doe@acme.example"},{"uuid":"9ef34ce3-3b69-4762-b5e8-045499390ce6","email":"john.smith@acme.example"}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://calendar.work.optidata.cloud/api/groups/distribution-list \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "email": "engineering@acme.example", "users": [ { "uuid": "9e926fb1-e1ff-4fc9-81a1-5740f10ba57f", "email": "jane.doe@acme.example" }, { "uuid": "9ef34ce3-3b69-4762-b5e8-045499390ce6", "email": "john.smith@acme.example" } ] }'Creates a distribution list at the given address and puts the listed users
on it. The response carries the new list’s zid, which the update and
delete operations use.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Address the list will answer at.
Initial members.
object
Optiwork UUID of the user.
Examples
{ "email": "engineering@acme.example", "users": [ { "uuid": "9e926fb1-e1ff-4fc9-81a1-5740f10ba57f", "email": "jane.doe@acme.example" }, { "uuid": "9ef34ce3-3b69-4762-b5e8-045499390ce6", "email": "john.smith@acme.example" } ]}Responses
Section titled “ Responses ”The distribution list was created.
object
Identifier of the list.
Examples
{ "message": "Distribution list created successfully", "zid": "5a1c1f7e-9f2d-4a6b-8a30-1c0d9d2f4b11", "email": "engineering@acme.example"}Missing, malformed or expired authentication key.
Authentication failures use an error key rather than message.
object
Examples
No bearer token sent
{ "error": "JWT passport exception: Missing bearer token in request"}The request failed validation, or the list could not be created at that address.
object
The first validation message.
Validation messages keyed by field name.
object
Generic error envelope used by policy, binding and framework failures.
object
Human-readable description of the failure.
Examples
The list could not be created
{ "message": "Failed to create distribution list"}Validation failed
{ "message": "The email field is required.", "errors": { "email": [ "The email field is required." ] }}Rate limit exceeded. Retry after the window resets.
Generic error envelope used by policy, binding and framework failures.
object
Human-readable description of the failure.
Examples
{ "message": "Too Many Attempts."}