Skip to content
Kim Rostgaard Christensen edited this page Jan 23, 2014 · 2 revisions

Drafts

Creating a new draft

POST /message/draft

With a <draft_object> in the body of the request.

Pushes a the supplied <draft_object> into draft list of the client.

Updating an existing draft

PUT /message/draft/<draft_id>/

With a <draft_object> in the body of the request.

Pushes a new version of the <draft_object> into draft list of the client.

Getting a list current drafts

GET /message/draft/list

Returns the draft list associated with current the client.

Messages

Getting the list of sent messages

GET /message/list

Returns a list of previously sent messages

Send

The client is responsible for deciding which contacts (at which organizations) should receive a message - and for indicating the wished visibility of the recipient. The actual recipient visibility may be lower with some messaging protocols.

The server maps a contact at an organization to a number of actual delivery addresses (using the messaging_addresses table). An actual delivery address will only appear once in a message delivery (with the highest of the selected visibilities for that address).

POST /message/send

{
  "to"      : [<contact_id>@<organization_id>+],
  "cc"      : [<contact_id>@<organization_id>*],
  "bcc"     : [<contact_id>@<organization_id>*],
  "message" : <message>

Sends <message> to the listed contacts using the selected visibilities ("to", "cc" or "bcc").

Condition: Success. The message was sent.

HTTP status: 200 OK

An empty object is returned.

Condition: Error. <message> too long, missing or invalid.

HTTP 400 Bad Request

{
  "status":      "bad request",
  "description": "passed message argument is too long, missing or invalid"
}

Condition: Error. No contacts selected.

HTTP 400 Bad Request

{
  "status":      "bad request",
  "description": "no contacts selected"
}

Condition: Error. <contact_id>@<organization_id> does not exist.

HTTP 404 Not Found

{
  "status":      "not found",
  "description": "one of the passed contacts could not be found in the database"
}

Condition: Error. No messaging addresses selected.

HTTP 404 Not Found

{
  "status":      "not found",
  "description": "none of the passed contacts have an enabled messaging address in the database"
}