Start a new chat

post

/rest/ofscCollaboration/v1/chats

This operation creates a new chat with another user or a conference chat with a group of users.

Request

Supported Media Types
Body ()
The schema of the request body object for this operation.
Root Schema : StartChatRequest
Type: object
The schema of the request body object for this operation.
Show Source
Nested Schema : recipients
Type: array
Minimum Number of Items: 1
The login of the message recipients in the chat.
Show Source
Back to Top

Response

Supported Media Types

201 Response

This section describes the 201 status response for this operation. This response code indicates that the operation completed successfully.
Body ()
Root Schema : StartChatResponse
Type: object
The details of the new chat.
Show Source
Nested Schema : participants
Type: array
Link to participant of the chat
Show Source

Default Response

This section describes the default error response for this operation.
Body ()
Root Schema : Error
Type: object
Error response
Show Source
Back to Top

Examples

The following example shows how to create a chat with another user or a group of users by submitting a POST request on the REST resource:

cURL Command Example

The following shows an example of the cURL command for a normal chat.

curl -X POST "https://<instance_name>.etadirect.com/rest/ofscCollaboration/v1/chats" -H "Accept: application/json" -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...W7B2fXbKpLz1m-sCG9QQA" -H "Content-Type: application/json" -d "{\"text\" : \"text message\", \"recipients\" : [\"smith\"]}"

The following shows an example of the cURL command for a conference chat.

curl -X POST "https://<instance_name>.etadirect.com/rest/ofscCollaboration/v1/chats" -H "Accept: application/json" -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...W7B2fXbKpLz1m-sCG9QQA" -H "Content-Type: application/json" -d "{\"text\" : \"test message\", \"recipients\" : [\"miller\", \"smith\"]}"

Response Header Example

The following shows an example of the response header.

HTTP/1.1 201 OK
Server: nginx
Date: Thu, 22 Apr 2019 16:28:18 GMT
Content-Type: application/json; charset=utf-8
Connection: close

Response Body Example

The following shows an example of the response body in JSON format.

{
    "chatId": 2,
    "type": "normal",
    "startedBy": "williams",
    "startedTime": "2019-04-22 11:46:58",
    "participants": {
        "links": [
            {
                "rel": "canonical",
                "href": "https://<instance_name>.etadirect.com/rest/ofscCollaboration/v1/chats/2/participants"
            }
        ]
    }
}
Back to Top