Send a message
post
/rest/ofscCollaboration/v1/chats/{chatId}/messages
This operation sends a message to an existing chat.
Request
Supported Media Types
- application/json
Path Parameters
-
chatId(required): integer
The unique identifier of the chat in Oracle Field Service.
The schema of the request body object for this operation.
Root Schema : SendMessageRequest
Type:
object
The schema of the request body object for this operation.
Show Source
-
attachment:
object Attachment
-
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 : 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 message was sent successfully.
Root Schema : SendMessageResponse
Type:
object
The response body object for this operation.
Show Source
-
author:
string
The login of the user who created this message.
-
chatId:
integer(int64)
The unique identifier of the chat in Oracle Field Service.
-
messageId:
integer(int32)
The unique identifier of the message in Oracle Field Service.
-
sequenceNumber:
integer(int32)
The sequence number of the message in the chat.
Note: This number may not be unique.
-
text:
string
The content of the message.
-
time:
string
The time (in UTC time zone) when the message was sent. The time is in 'YYYY-MM-DD HH:MM:SS' format.
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 send a message to an existing chat by submitting a POST request on the REST resource:
cURL command Example
The following shows an example of the cURL command.
curl -X POST "https://<instance_name>.fs.ocs.oraclecloud.com/rest/ofscCollaboration/v1/chats/1/messages" -H "Accept: application/json" -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...p6aZOp6sT1k3j-7WIlK6bbbLg" -H "Content-Type: application/json" -d "{\"text\" : \"Message Text\"}"
Response Header Example
The following shows an example of the response header.
HTTP/1.1 200 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": 1, "text": "Message Text", "author": "williams", "time": "2019-04-22 09:47:34", "sequenceNumber": 6, "messageId": 6 }