Out of Office
With these APIs your own applications can turn the out-of-office setting of an employee on and off, and read it.
All three APIs:
- Must be authenticated with HMAC Authentication. See the Authentication document.
- Use HTTP POST with Content-Type application/json.
- Identify the employee with either
userId(Diyalog user id) orstaffId(the employee number in your organization). If both are sent,userIdis used. If neither is sent, the request fails.
Changes made with staffId are written to the audit log.
POST v1/application/enableoutofoffice#
Turns on out of office for an employee. Messages to the employee can be forwarded to other employees while it is on.
API URI: https://DIYALOG-SERVER-API-ENDPOINT/v1/application/enableoutofoffice
Request body#
| Field | Type | Required | Description |
|---|---|---|---|
userId | int | One of userId / staffId | Diyalog user id of the employee |
staffId | string | One of userId / staffId | Employee number of the employee |
outOfOfficeMessage | string | Yes | Out-of-office message shown to people who write to the employee |
beginDate | long | No | Start time in epoch milliseconds. Omitted: starts immediately. |
endDate | long | No | End time in epoch milliseconds. Omitted: no end time. |
forwardToUserIds | int[] | No | Diyalog user ids of the employees to forward to |
forwardToStaffIds | string[] | No | Employee numbers of the employees to forward to. Used only when forwardToUserIds is not sent. |
Every forward target must exist; otherwise the request fails.
Example request body#
Response#
| Field | Type | Description |
|---|---|---|
isSuccess | boolean | true when out of office was turned on |
message | string | Result text, e.g. Out of office enabled |
error | string | Error text; present only on failure |
seq | int | Sequence number of the user update produced by the change |
Example response body#
POST v1/application/disableoutofoffice#
Turns off out of office for an employee.
API URI: https://DIYALOG-SERVER-API-ENDPOINT/v1/application/disableoutofoffice
Request body#
| Field | Type | Required | Description |
|---|---|---|---|
userId | int | One of userId / staffId | Diyalog user id of the employee |
staffId | string | One of userId / staffId | Employee number of the employee |
Example request body#
Response#
Same fields as enableoutofoffice.
POST v1/application/getuseroutofofficeinfo#
Returns the current out-of-office setting of an employee.
API URI: https://DIYALOG-SERVER-API-ENDPOINT/v1/application/getuseroutofofficeinfo
Request body#
| Field | Type | Required | Description |
|---|---|---|---|
userId | int | One of userId / staffId | Diyalog user id of the employee |
staffId | string | One of userId / staffId | Employee number of the employee |
Response#
| Field | Type | Description |
|---|---|---|
enabled | boolean | Whether out of office is on |
beginDate | long | Start time in epoch milliseconds; absent when no start time was set |
endDate | long | End time in epoch milliseconds; absent when no end time was set |
forwardedUserIds | int[] | Diyalog user ids messages are forwarded to |
forwardedStaffIds | string[] | Employee numbers of the same employees |
outOfOfficeMessage | string | The out-of-office message |
Example response body#
Errors#
| HTTP status | When |
|---|---|
| 400 | The request body is not valid JSON for this API. The error text is returned as plain text. |
| 500 | The operation failed, e.g. no userId or staffId was given, the employee or a forward target was not found. The error text is returned as plain text. |
If the request fails HMAC validation, the following errors are returned as plain text. See Authentication.
| HTTP status | Message | Description |
|---|---|---|
| 400 | Required headers not found | One or more of the x-dlg-date, x-dlg-requester-userid or x-dlg-authorization headers are missing. |
| 400 | Authorization failed due to data format not valid | The x-dlg-authorization value after DLGA is not in the AccessKeyId:Signature form. |
| 400 | Date format is invalid. EEE, dd MMM yyyy HH:mm:ss Z is requied | The x-dlg-date value cannot be parsed in this format. The message text is returned as shown, including its spelling. |
| 401 | Authorization failed | The x-dlg-authorization header does not contain DLGA , the AccessKeyId is unknown, or the signature is not correct. |
| 401 | You have no permission on this operation. Contact your admin. | The signature is correct, but your access key has no application permission. |
| 403 | Request time may not be correct. | The x-dlg-date value differs from the server time by more than 15 minutes. |