Start a new chat
post
/rest/ofscCollaboration/v1/chats
This operation creates a new chat with another user, helpdesk or a conference chat with a group of users.
Request
Supported Media Types
- application/json
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
-
attachment:
object Attachment
-
helpdesk:
integer
helpdesk id
-
recipients:
array recipients
Minimum Number of Items:
1
The login of the message recipients in the chat. -
text:
string
Minimum Length:
1
Maximum Length:1000
The content of the message.
Nested Schema : Attachment
Type:
Show Source
object
-
content:
object ImageContent
-
id:
string
attachment entity ID. activity, resource or inventory ID. no ID field required for image type
-
type(required):
string
Allowed Values:
[ "activity", "resource", "inventory", "image" ]
type of attachment
Nested Schema : recipients
Type:
array
Minimum Number of Items:
1
The login of the message recipients in the chat.
Show Source
Nested Schema : ImageContent
Type:
Show Source
object
-
filename(required):
string
image file name
-
imageData(required):
string
base64 value of the image content
-
mediaType(required):
string
media type
Response
Supported Media Types
- application/json
201 Response
This section describes the 201 status response for this operation. This response code indicates that the operation completed successfully.
Root Schema : StartChatResponse
Type:
object
The details of the new chat.
Show Source
-
chatId:
integer(int64)
The unique identifier of the chat in Oracle Field Service.
-
participants:
array participants
Link to participant of the chat
-
startedBy:
string
The login of the user who started the chat. This field is present only for the chats started by a user.
-
startedTime:
string
The time (in UTC time zone) when the chat started. The time is in 'YYYY-MM-DD HH:MM:SS' format.
-
type:
string
Allowed Values:
[ "normal", "conference" ]
The type of the chat. The possible values of this field are:
- normal - A chat between two participants
- conference - A chat with more than two participants
Nested Schema : participants
Type:
array
Link to participant of the chat
Show Source
-
Array of:
object PaginationLink
The pagination links.
Default Response
This section describes the default error response for this operation.
Root Schema : Error
Type:
Show Source
object
-
detail:
string
The detailed description of this error.
-
status:
string
The HTTP status code of this error.
-
title(required):
string
The brief description of this error.
-
type(required):
string
The URL of the web page containing more details about this error.
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>.fs.ocs.oraclecloud.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>.fs.ocs.oraclecloud.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>.fs.ocs.oraclecloud.com/rest/ofscCollaboration/v1/chats/2/participants" } ] } }