Messages

Get Single Message

curl "https://example.ziik.io/api/messages/2"
  -H "Authorization: Bearer aaaaaa.bbbbbbb.ccccccc"

The above command returns JSON structured like this:

{
  "id": 2,
  "author": {
    "id": 123,
    "name": "Test User",
    "avatar": { "See User Service ..." },
    "userType": { "See User Service ..." },
    "url": "api/users/123"
  },
  "conversationId": 2,
  "message": "This is a message",
  "files": [ ],
  "is_new": true,
  "url": "api/messages/2"
}

This endpoint retrieves a specific message.

HTTP Request

GET https://example.ziik.io/api/messages/ID

URL Parameters

ParameterTypeDescription
IDIntegerThe ID of the message to retrieve

Reply To Message

curl -i -X POST "https://example.ziik.io/api/messages/1234/reply"
  -H "Authorization: Bearer aaaaaaaaa.bbbbbbbbb.cccccccccc"
  -d "{\"message\": \"This message is for all of you\"}"

The above command returns 201 Created with a location header for where to find the new message. Additionally, the created message is returned

HTTP/1.0 201 Created
Location: https://example.ziik.io/api/chat/1234
{
  "id": 2,
  "author": {
    "id": 123,
    "name": "Test User",
    "avatar": { "See User Service ..." },
    "userType": { "See User Service ..." },
    "url": "api/users/123"
  },
  "conversationId": 2,
  "message": "This is a message",
  "files": [ ],
  "is_new": true,
  "url": "api/messages/2"
}

This endpoint creates a new message as a reply to an existing message

HTTP Request

POST https://example.ziik.io/api/messages/ID/reply

Request Parameters

ParameterTypeRequiredDescription
messageStringYesMessage string.
fileCountIntegerNoNumber of files that will be uploaded (type 'upload') in total, including subsequent POSTs to /api/messages/ID/files
filesArrayNoFile data for files to accompany the debate. If provided, existing files are cleared. Must be an array of arrays with the following values
- typeStringYesType of file - can be either 'upload', 'youtube' or 'vimeo'.
- nameStringYesFile name.
- dataStringYesIf type is 'upload' this must be the base64 encoded content of the file. Else it must be the Youtube/Vimeo embed URL.

Delete a Message

curl -i -X DELETE "https://example.ziik.io/api/messages/2"
  -H "Authorization: Bearer aaaaaa.bbbbbbb.ccccccc"

The above command returns a 204 No Content header on success:

HTTP/1.0 204 No Content

This endpoint deletes a specific message for the current user. The message will still be visible to other participants who have not deleted it, yet.

HTTP Request

DELETE https://example.ziik.io/api/messages/ID

URL Parameters

ParameterTypeDescription
IDIntegerThe ID of the message to delete

Mark Message Read

curl -i -X POST "https://example.ziik.io/api/messages/2/read"
  -H "Authorization: Bearer aaaaaaaaa.bbbbbbbbb.cccccccccc"

The above command returns 204 No Content on success

HTTP/1.0 204 No Content

This endpoint marks a message as read by the current user.

HTTP Request

POST https://example.ziik.io/api/messages/ID/read

URL Parameters

ParameterTypeDescription
IDIntegerThe ID of the message to mark read

Add Files To Message

curl -i -X POST "https://example.ziik.io/api/messages/files"
  -H "Authorization: Bearer aaaaaaaaa.bbbbbbbbb.cccccccccc"
  -d "{ [...] }"

The above command returns 204 No Content on success

HTTP/1.0 204 No Content

This endpoint adds files to an existing chat message.

HTTP Request

POST https://example.ziik.io/api/messages/files

Request Parameters

ParameterTypeDescription
idIntegerThe ID of the message to add files to
filesArrayNo
- typeStringYes
- nameStringYes
- dataStringYes

Permissions Required

  • Message author