AWA Agent API
The AWA (Advanced Work Assignment) Agent API provides endpoints to manage agent presence, channel availability, and workload.
This API requires the Advanced Work Assignment (com.glide.awa) plugin and the awa_integration_user role. For more information, refer to Advanced Work Assignment.
AWA Agent - GET /now/awa/agents/{user_id}
Returns the current agent presence state and channel availability.
URL format
Versioned URL: /api/now/{api_version}/awa/agents/{user_id}
Default URL: /api/now/awa/agents/{user_id}
Supported request parameters
| Name | Description |
|---|---|
| api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
| user_id | Sys_id of the work item.
The work item must meet the following criteria:
Data type: String Table: AWA Work Item [awa_work_item] |
| Name | Description |
|---|---|
| None |
| Header | Description |
|---|---|
| presence.channels.available | Flag that indicates whether the channel is available.
Possible values:
Data type: Boolean |
| presence.channels.sys_id | Channel sys_id.
Data type: String Table: Service Channels [awa_service_channel] |
| presence.sys_id | Presence state sys_id.
Data type: String Table: Presence States [awa_presence_state] |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Header | Description |
|---|---|
| Accept | Data format of the response body. Supported types: application/json or application/xml.
Default: application/json |
| Content-Type | Data format of the request body. Supported types: application/json or application/xml.
Default: application/json |
| Header | Description |
|---|---|
| None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 400 | Bad Request. A bad request type or malformed request was detected. |
| 401 | Unauthorized. The user credentials are incorrect or have not been passed. |
| 403 | Forbidden. Possible reasons:
|
| 404 | Not found. The requested item wasn't found. |
| 500 | Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error. |
Response body parameters (JSON or XML)
| Parameter | Description |
|---|---|
| error | Details describing an error encountered during the request process. Data type: Object |
| error.detail | Details of the error encountered during the
request process.
Data type: String |
| error.message | Message for the error encountered during the request process. Each error message has a corresponding description in the detail property. Possible values:
Data type: String |
| presence | Information about an agent's current presence state and channel.
Data type: Object |
| presence.available | Flag that indicates whether the agent is available.
Possible values:
Data type: Boolean |
| presence.channels | List of objects that describe the available channels of communication with the agent.
Data type: Array of Objects |
| presence.channels.available | Flag that indicates whether the channel is available.
Possible values:
Data type: Boolean |
| presence.channels.name | Channel name, such as Chat or Phone.
Data type: String |
| presence.channels.restrict_update | Flag that indicates whether the user can restrict updates, that is, select the channel for availability. Possible values:
Data type: Boolean |
| presence.channels.service_channel_type | Service channel type, such as chat. Possible values vary depending on plugins
installed. Data type: String |
| presence.channels.sys_id | Channel sys_id.
Data type: String Table: Service Channels [awa_service_channel] |
| presence.name | Name of the agent's presence state.
Possible values:
Data type: String |
| presence.restrict_update | Flag that indicates whether the user can restrict updates.
Possible values:
Data type: Boolean |
| presence.sys_id | Presence state sys_id.
Data type: String Table: Presence States [awa_presence_state] |
| status | Status of an unsuccessful request. This property is only included in the response if there is an error. Valid value: failure Data type: String |
| sys_id | Agent sys_id.
Data type: String |
| workItem |
workItem: Information about the work item that is associated with the event. Data type: String |
| workItem.document | workItem.document: List of documents associated with the work item task. Data type: String |
| workItem.document.sys_id | workItem.document.sys_id: Sys_id of the document assigned to the work item task. Data type: String |
| workItem.document.table | workItem.document.table: Name of the document table assigned to the task. Data type: String |
| workItem.previousWorkItem | workItem.previousWorkItem: Sys_id of the previous work item for the same document ID. For the non-transfer work items this value is empty. Data type: String |
| workItem.serviceChannel | workItem.serviceChannel: List of service channels associated with the work item task. Data type: String |
| workItem.serviceChannel.name | workItem.serviceChannel.name: Name of the service channel, such as Chat or Phone. Data type: String |
| workItem.serviceChannel.sys_id | workItem.serviceChannel.sys_id: Sys_id of the service channel. Data type: String |
| workItem.size | workItem.size: Agent's capacity used when this work item is assigned to the agent. Data type: String |
| workItem.sys_id | workItem.sys_id: Sys_id of the work item that was accepted or offered. Data type: String |
| workItem.isQueueTransferred | workItem.isQueueTransferred: Flag that indicates whether the work item is queue transferred. Set to true if the work item is queue transferred, false if
it isn't. For more information on queue transfers, see . Data type: Boolean |
| workitem.isAutoAccepted | workItem.isAutoAccepted: Flag that indicates whether the work item was automatically accepted by the system. Set to true if the work item was
auto-accepted. Data type: Boolean |
Sample cURL request
curl -X GET \
https://instance.servicenow.com/api/now/awa/agents/46d44a23a9fe19810012d100cca80666 \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-u 'username':'password'\
{
"result": {
"presence": {
"name": "Available",
"sys_id": "0b10223c57a313005baaaa65ef94f970",
"available": true,
"channels": [
{
"name": "Chat",
"available": true,
"sys_id": "27f675e3739713004a905ee515f6a7c3"
}
]
},
"sys_id": "46d44a23a9fe19810012d100cca80666"
}
}
AWA Agent - GET /now/awa/agents/{user_id}/capacities
Returns an agent's channel capacities, universal capacity, and the current workload to see if the agent can handle a case.
Use the AWA Agent - PUT /now/awa/agents/{user_id}/capacities method to modify the channel and universal capacities of an agent.
URL format
Versioned URL: /api/now/{api_version}/awa/agents/{user_id}/capacities
Default URL: /api/now/awa/agents/{user_id}/capacities
Supported request parameters
| Name | Description |
|---|---|
| api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
| user_id | Sys_id of the agent listed. Data type: String Table: User [sys_user] |
| Name | Description |
|---|---|
| None |
| Name | Description |
|---|---|
| None |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Header | Description |
|---|---|
| Accept | Data format of the response body. Supported types: application/json or application/xml.
Default: application/json |
| Header | Description |
|---|---|
| None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 400 | Bad Request. A bad request type or malformed request was detected. |
| 401 | Unauthorized. The user credentials are incorrect or have not been passed. |
| 403 | Forbidden. Possible reasons:
|
| 404 | Not found. The requested item wasn't found. |
| 500 | Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error. |
Response body parameters (JSON or XML)
| Name | Description |
|---|---|
| channels | List of objects that describe the available channels of communication with the agent.
Data type: Array |
| channels.channel_sys_id | Channel sys_id.
Data type: String Table: Service Channels [awa_service_channel] |
| channels.current_workload | Number of work items on a specific service channel currently assigned to the
agent. Data type: Number |
| channels.max_capacity | Maximum workload on a specific service channel that the agent can be actively assigned to at a time.
Data type: String |
| error | Details describing an error encountered during the request process. Data type: Object |
| error.detail | Details of the error encountered during the
request process.
Data type: String |
| error.message | Message for the error encountered during the request process. The description is provided in the error.detail
property. Data type: String |
| status | Status of an unsuccessful request. This property is only included in the response if there is an error. Valid value: failure Data type: String |
| universal_capacity | Maximum capacity for the agent across all service channels. If an agent's current workload equals the maximum universal capacity, additional work items won't be assigned to the
agent.
This property only returns if a universal capacity record exists for this agent. Data type: Number |
| universal_workload | Number of work items across all service channels currently assigned to the
specified agent. This property only returns if a universal capacity record exists for the agent. Data type: Number |
Sample cURL request
The following example shows how to get the capacity and workload values for a user.
curl "https://instance.service-now.com/api/now/awa/agents/46d44a23a9fe19810012d100cca80666/capacities" \
--request GET \
--header "Accept:application/json" \
--user 'username':'password'
A successful response includes capacity values and workload for each channel.
{
"result": {
"universal_workload": 2,
"channels": [
{
"channel_sys_id": "27f675e3739713004a905ee515f6a7c3",
"current_workload": 2,
"max_capacity": 4
}
],
"universal_capacity": 10
}
}
AWA Agent - GET /now/awa/agents/{user_id}/presence_states
Returns an agent's presence states and indicates whether the agent is available or in another presence state.
URL format
Versioned URL: /api/now/{api_version}/awa/agents/{user_id}/presence_states
Default URL: /api/now/awa/agents/{user_id}/presence_states
Supported request parameters
| Name | Description |
|---|---|
| api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
| user_id | Sys_id of the agent listed. Data type: String Table: User [sys_user] |
| Name | Description |
|---|---|
| None |
| Name | Description |
|---|---|
| None |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Header | Description |
|---|---|
| Accept | Data format of the response body. Supported types: application/json or application/xml.
Default: application/json |
| Header | Description |
|---|---|
| None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 400 | Bad Request. A bad request type or malformed request was detected. |
| 401 | Unauthorized. The user credentials are incorrect or have not been passed. |
| 403 | Forbidden. Possible reasons:
|
| 404 | Not found. The requested item wasn't found. |
| 500 | Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error. |
Response body parameters (JSON or XML)
| Name | Description |
|---|---|
| error | Details describing an error encountered during the request process. Data type: Object |
| error.detail | Details of the error encountered during the
request process.
Data type: String |
| error.message | Message for the error encountered during the request process. The description is provided in the error.detail
property. Data type: String |
| <presence state> | List of the agent's presence state definitions as objects. Each object
describes the state and includes the agent's channels. Data type: Array |
| <presence state>.available | Flag that indicates whether the agent is available.
Possible values:
Data type: Boolean |
| <presence state>.channels | List of objects that describe the available channels of communication with the agent.
Data type: Array |
| <presence state>.channels.available | Flag that indicates whether the channel is available.
Possible values:
Data type: Boolean |
| <presence state>.channels.name | Channel name, such as Chat or Phone.
Data type: String |
| <presence state>.channels.sys_id | Channel sys_id.
Data type: String Table: Service Channels [awa_service_channel] |
| <presence state>.disable_inactivity_check | Flag that indicates whether to check for inactivity of this presence
state. Valid values:
Data type: Boolean Default: false For information on how to modify this setting, see Configure agent presence states. |
| <presence state>.name | Name of the agent's presence state. The presence states installed by default are
Available, Away, and
Offline. Data type: String |
| <presence state>.order | Order in which this state is displayed in the agent inbox. Data type: Number |
| <presence state>.show_channels | Flag that indicates whether the agent has permission to change presence state,
for example, from available to away. Valid values:
Data type: Boolean |
| <presence state>.sys_id | Presence state sys_id.
Data type: String Table: Presence States [awa_presence_state] |
| status | Status of an unsuccessful request. This property is only included in the response if there is an error. Valid value: failure Data type: String |
Sample cURL request
The following example shows how to get the presence states for a specified agent.
curl "https://instance.service-now.com/api/now/awa/agents/46d44a23a9fe19810012d100cca80666/presence_states" \
--request GET \
--header "Accept:application/json" \
--user 'username':'password'
The response body lists the agent's possible presence states and indicates that the agent is available.
{
"result": [
{
"name": "Available",
"order": 0,
"show_channels": false,
"sys_id": "0b10223c57a313005baaaa65ef94f970",
"available": true,
"channels": [
{
"name": "Chat",
"available": true,
"sys_id": "27f675e3739713004a905ee515f6a7c3",
"restrict_update": false,
"service_channel_type": "chat"
}
],
"disable_inactivity_check": false
},
{
"name": "Away",
"order": 1000,
"show_channels": false,
"sys_id": "41f9b8dfb31313005baa6e5f26a8dcac",
"available": false,
"channels": [],
"disable_inactivity_check": false
},
{
"name": "Offline",
"order": 2000,
"show_channels": false,
"sys_id": "9cd83267575313005baaaa65ef94f98b",
"available": false,
"channels": [],
"disable_inactivity_check": false
}
]
}
AWA Agent - PUT /now/awa/agents/{user_id}
Sets the state of a specified agent’s presence and, if provided, sets the agent’s channel availability for that state.
URL format
Versioned URL: /api/now/{api_version}/awa/agents/{user_id}
Default URL: /api/now/awa/agents/{user_id}
Supported request parameters
| Name | Description |
|---|---|
| api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
| user_id | Sys_id of the agent. Data type: String Table: User [sys_user] |
| Name | Description |
|---|---|
| None |
| Name | Description |
|---|---|
| presence.channels | List of objects that define which channels are available for the agent. Data type: Array of Objects |
| presence.channels.available | Flag that indicates whether the channel is available.
Possible values:
注:
This setting must be specified to include channels in the response body. Data type: Boolean Default: false |
| presence.channels.sys_id | Channel sys_id.
Data type: String Table: Service Channels [awa_service_channel] |
| presence.sys_id | Presence state sys_id.
Data type: String Table: Presence States [awa_presence_state] |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Header | Description |
|---|---|
| Accept | Data format of the response body. Supported types: application/json or application/xml.
Default: application/json |
| Content-Type | Data format of the request body. Supported types: application/json or application/xml.
Default: application/json |
| Header | Description |
|---|---|
| None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 400 | Bad Request. A bad request type or malformed request was detected. |
| 401 | Unauthorized. The user credentials are incorrect or have not been passed. |
| 403 | Forbidden. Possible reasons:
|
| 404 | Not found. The requested item wasn't found. |
| 500 | Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error. |
| Parameter | Description |
|---|---|
| error | Details describing an error encountered during the request process. Data type: Object |
| error.detail | Details of the error encountered during the
request process.
Data type: String |
| error.message | Message for the error encountered during the request process. Each error message has a corresponding description in the detail property. Possible values:
Data type: String |
| presence | Information about an agent's current presence state and channel.
Data type: Object |
| presence.available | Flag that indicates whether the agent is available.
Possible values:
Data type: Boolean |
| presence.channels | List of objects that describe the available channels of communication with the agent.
Data type: Array of Objects |
| presence.channels.available | Flag that indicates whether the channel is available.
Possible values:
Data type: Boolean |
| presence.channels.name | Channel name, such as Chat or Phone.
Data type: String |
| presence.channels.restrict_update | Flag that indicates whether the user can restrict updates, that is, select the channel for availability. Possible values:
Data type: Boolean |
| presence.channels.service_channel_type | Service channel type, such as chat. Possible values vary depending on plugins
installed. Data type: String |
| presence.channels.sys_id | Channel sys_id.
Data type: String Table: Service Channels [awa_service_channel] |
| presence.name | Name of the agent's presence state.
Possible values:
Data type: String |
| presence.restrict_update | Flag that indicates whether the user can restrict updates.
Possible values:
Data type: Boolean |
| presence.sys_id | Presence state sys_id.
Data type: String Table: Presence States [awa_presence_state] |
| status | Status of an unsuccessful request. This property is only included in the response if there is an error. Valid value: failure Data type: String |
| sys_id | Agent sys_id.
Data type: String |
| workItem |
workItem: Information about the work item that is associated with the event. Data type: String |
| workItem.document | workItem.document: List of documents associated with the work item task. Data type: String |
| workItem.document.sys_id | workItem.document.sys_id: Sys_id of the document assigned to the work item task. Data type: String |
| workItem.document.table | workItem.document.table: Name of the document table assigned to the task. Data type: String |
| workItem.previousWorkItem | workItem.previousWorkItem: Sys_id of the previous work item for the same document ID. For the non-transfer work items this value is empty. Data type: String |
| workItem.serviceChannel | workItem.serviceChannel: List of service channels associated with the work item task. Data type: String |
| workItem.serviceChannel.name | workItem.serviceChannel.name: Name of the service channel, such as Chat or Phone. Data type: String |
| workItem.serviceChannel.sys_id | workItem.serviceChannel.sys_id: Sys_id of the service channel. Data type: String |
| workItem.size | workItem.size: Agent's capacity used when this work item is assigned to the agent. Data type: String |
| workItem.sys_id | workItem.sys_id: Sys_id of the work item that was accepted or offered. Data type: String |
| workItem.isQueueTransferred | workItem.isQueueTransferred: Flag that indicates whether the work item is queue transferred. Set to true if the work item is queue transferred, false if
it isn't. For more information on queue transfers, see . Data type: Boolean |
| workitem.isAutoAccepted | workItem.isAutoAccepted: Flag that indicates whether the work item was automatically accepted by the system. Set to true if the work item was
auto-accepted. Data type: Boolean |
curl -X PUT \
https://instance.servicenow.com/api/now/awa/agents/46d44a23a9fe19810012d100cca80666 \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-u 'username':'password'\
-d '{"presence": {\
"sys_id": "0b10223c57a313005baaaa65ef94f970",\
"channels": [{ \
"sys_id": "0bbdedbb3b892300a2bac9bb34efc445",\
"available": true
}]
}}
{
"result": {
"presence": {
"name": "Available",
"sys_id": "0b10223c57a313005baaaa65ef94f970",
"available": true,
"channels": [
{
"name": "Chat",
"available": true,
"sys_id": "27f675e3739713004a905ee515f6a7c3"
}
]
},
"sys_id": "46d44a23a9fe19810012d100cca80666"
}
}
AWA Agent - PUT /now/awa/agents/{user_id}/capacities
Enables updating an agent's maximum capacity (workload) for channel capacities and universal capacity.
Use the AWA Agent - GET /now/awa/agents/{user_id}/capacities method to retrieve the current channel and universal capacities of an agent.
URL format
Versioned URL: /api/now/{api_version}/awa/agents/{user_id}/capacities
Default URL: /api/now/awa/agents/{user_id}/capacities
Supported request parameters
| Name | Description |
|---|---|
| api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
| user_id | Sys_id of the agent listed. Data type: String Table: User [sys_user] |
| Name | Description |
|---|---|
| None |
| Name | Description |
|---|---|
| channels | Mandatory if updating the maximum value of one or more channels for the
specified agent. JSON object containing one or more key-value pairs mapping the
channel to its maximum capacity for each channel assigned to the agent. Data type: Object The pair is in the following format:
|
| universal_capacity | Mandatory if universal capacity is being updated. Maximum capacity for the agent across all service channels. If an agent's current workload equals the maximum universal capacity, additional work items won't be assigned to the
agent.
Data type: Number |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
| Header | Description |
|---|---|
| Accept | Data format of the response body. Supported types: application/json or application/xml.
Default: application/json |
| Header | Description |
|---|---|
| None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 400 | Bad Request. A bad request type or malformed request was detected. |
| 404 | Not found. The requested item wasn't found. |
Response body parameters (JSON or XML)
| Name | Description |
|---|---|
| channels | List of objects that describe the available channels of communication with the agent.
Data type: Array |
| channels.channel_sys_id | Channel sys_id.
Data type: String Table: Service Channels [awa_service_channel] |
| channels.max_capacity | Maximum workload on a specific service channel that the agent can be actively assigned to at a time.
Data type: String |
| error | Details describing an error encountered during the request process. Data type: Object |
| error.detail | Details of the error encountered during the
request process.
Data type: String |
| error.message | Message for the error encountered during the request process. The description is provided in the error.detail
property. Data type: String |
| status | Status of an unsuccessful request. This property is only included in the response if there is an error. Valid value: failure Data type: String |
| universal_capacity | Maximum capacity for the agent across all service channels. If an agent's current workload equals the maximum universal capacity, additional work items won't be assigned to the
agent.
This property only returns if a universal capacity record exists for this agent. Data type: Number |
Sample cURL request
The following example shows how to change the agent's universal capacity and the maximum capacity for a specified channel.
curl "https://instance.service-now.com/api/now/awa/agents/46d44a23a9fe19810012d100cca80666/capacities" \
--request PUT \
--header "Accept:application/json" \
--header "Content-Type:application/json" \
--data "{
\"channels\": { \"27f675e3739713004a905ee515f6a7c3\": 6 },
\"universal_capacity\" : 12
}" \
--user 'username':'password'
A successful response includes the updated capacity values.
{
"result": {
"channels": [
{
"channel_sys_id": "27f675e3739713004a905ee515f6a7c3",
"max_capacity": 6
}
],
"universal_capacity": 12
}
}