Table of Contents
Available as of Camel 2.18
The ServiceNow component provides access to ServiceNow platform through their REST API.
![]() | Note |
|---|---|
From Camel 2.18.1 the component supports multiple version of ServiceNow platform with default to Helsinki. Supported version are Table 151, “API Mapping” and Table 152, “API Mapping” |
Maven users will need to add the following dependency to their pom.xml for this component:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-servicenow</artifactId>
<version>${camel-version}</version>
</dependency>The ServiceNow component supports 7 options which are listed below.
{% raw %}
| Name | Java Type | Description |
|---|---|---|
configuration |
| The ServiceNow default configuration |
apiUrl |
| The ServiceNow REST API url |
userName |
| ServiceNow user account name |
password |
| ServiceNow account password |
oauthClientId |
| OAuth2 ClientID |
oauthClientSecret |
| OAuth2 ClientSecret |
oauthTokenUrl |
| OAuth token Url |
{% endraw %}
The ServiceNow component supports 41 endpoint options which are listed below:
{% raw %}
| Name | Group | Default | Java Type | Description |
|---|---|---|---|---|
instanceName | producer |
| Required The ServiceNow instance name | |
display | producer |
|
| Set this parameter to true to return only scorecards where the indicator Display field is selected. Set this parameter to all to return scorecards with any Display field value. This parameter is true by default. |
displayValue | producer |
|
| Return the display value (true) actual value (false) or both (all) for reference fields (default: false) |
excludeReferenceLink | producer |
| True to exclude Table API links for reference fields (default: false) | |
favorites | producer |
| Set this parameter to true to return only scorecards that are favorites of the querying user. | |
includeAggregates | producer |
| Set this parameter to true to always return all available aggregates for an indicator including when an aggregate has already been applied. If a value is not specified this parameter defaults to false and returns no aggregates. | |
includeAvailableAggregates | producer |
| Set this parameter to true to return all available aggregates for an indicator when no aggregate has been applied. If a value is not specified this parameter defaults to false and returns no aggregates. | |
includeAvailableBreakdowns | producer |
| Set this parameter to true to return all available breakdowns for an indicator. If a value is not specified this parameter defaults to false and returns no breakdowns. | |
includeScoreNotes | producer |
| Set this parameter to true to return all notes associated with the score. The note element contains the note text as well as the author and timestamp when the note was added. | |
includeScores | producer |
| Set this parameter to true to return all scores for a scorecard. If a value is not specified this parameter defaults to false and returns only the most recent score value. | |
inputDisplayValue | producer |
| True to set raw value of input fields (default: false) | |
key | producer |
| Set this parameter to true to return only scorecards for key indicators. | |
models | producer |
| Defines both request and response models | |
perPage | producer |
|
| Enter the maximum number of scorecards each query can return. By default this value is 10 and the maximum is 100. |
release | producer |
|
| The ServiceNow release to target default to Helsinki See https://docs.servicenow.com |
requestModels | producer |
| Defines the request model | |
resource | producer |
| The default resource can be overridden by header CamelServiceNowResource | |
responseModels | producer |
| Defines the response model | |
sortBy | producer |
| Specify the value to use when sorting results. By default queries sort records by value. | |
sortDir | producer |
| Specify the sort direction ascending or descending. By default queries sort records in descending order. Use sysparm_sortdir=asc to sort in ascending order. | |
suppressAutoSysField | producer |
| True to suppress auto generation of system fields (default: false) | |
suppressPaginationHeader | producer |
| Set this value to true to remove the Link header from the response. The Link header allows you to request additional pages of data when the number of records matching your query exceeds the query limit | |
table | producer |
| The default table can be overridden by header CamelServiceNowTable | |
target | producer |
| Set this parameter to true to return only scorecards that have a target. | |
topLevelOnly | producer |
| Gets only those categories whose parent is a catalog. | |
apiVersion | advanced |
| The ServiceNow REST API version default latest | |
httpClientPolicy | advanced |
| To configure http-client | |
mapper | advanced |
| Sets Jackson’s ObjectMapper to use for request/reply | |
proxyAuthorizationPolicy | advanced |
| To configure proxy authentication | |
synchronous | advanced |
|
| Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). |
proxyHost | proxy |
| The proxy host name | |
proxyPort | proxy |
| The proxy port number | |
apiUrl | security |
| The ServiceNow REST API url | |
oauthClientId | security |
| OAuth2 ClientID | |
oauthClientSecret | security |
| OAuth2 ClientSecret | |
oauthTokenUrl | security |
| OAuth token Url | |
password | security |
| ServiceNow account password MUST be provided | |
proxyPassword | security |
| Password for proxy authentication | |
proxyUserName | security |
| Username for proxy authentication | |
sslContextParameters | security |
| To configure security using SSLContextParameters. See http://camel.apache.org/camel-configuration-utilities.html | |
userName | security |
| ServiceNow user account name MUST be provided |
{% endraw %}
| Name | Type | ServiceNow API Parameter | Endpoint option | Description |
|---|---|---|---|---|
CamelServiceNowResource | String | - | - | The resource to access |
CamelServiceNowAction | String | - | - | The action to perform |
CamelServiceNowActionSubject | - | - | String | The subject to which the action should be applied |
CamelServiceNowModel | Class | - | - | The data model |
CamelServiceNowRequestModel | Class | - | - | The request data model |
CamelServiceNowResponseModel | Class | - | - | The response data model |
CamelServiceNowOffsetNext | - | - | - | - |
CamelServiceNowOffsetPrev | - | - | - | - |
CamelServiceNowOffsetFirst | - | - | - | - |
CamelServiceNowOffsetLast | - | - | - | - |
CamelServiceNowContentType | - | - | - | - |
CamelServiceNowContentEncoding | - | - | - | - |
CamelServiceNowContentMeta | - | - | - | - |
CamelServiceNowSysId | String | sys_id | - | - |
CamelServiceNowUserSysId | String | user_sysid | - | - |
CamelServiceNowUserId | String | user_id | - | - |
CamelServiceNowCartItemId | String | cart_item_id | - | - |
CamelServiceNowFileName | String | file_name | - | - |
CamelServiceNowTable | String | table_name | - | - |
CamelServiceNowTableSysId | String | table_sys_id | - | - |
CamelServiceNowEncryptionContext | String | encryption_context | - | - |
CamelServiceNowCategory | String | sysparm_category | - | - |
CamelServiceNowType | String | sysparm_type | - | - |
CamelServiceNowCatalog | String | sysparm_catalog | - | - |
CamelServiceNowQuery | String | sysparm_query | - | - |
CamelServiceNowDisplayValue | String | sysparm_display_value | displayValue | - |
CamelServiceNowInputDisplayValue | Boolean | sysparm_input_display_value | inputDisplayValue | - |
CamelServiceNowExcludeReferenceLink | Boolean | sysparm_exclude_reference_link | excludeReferenceLink | - |
CamelServiceNowFields | String | sysparm_fields | - | - |
CamelServiceNowLimit | Integer | sysparm_limit | - | - |
CamelServiceNowText | String | sysparm_text | - | - |
CamelServiceNowOffset | Integer | sysparm_offset | - | - |
CamelServiceNowView | String | sysparm_view | - | - |
CamelServiceNowSuppressAutoSysField | Boolean | sysparm_suppress_auto_sys_field | suppressAutoSysField | - |
CamelServiceNowSuppressPaginationHeader | Booleab | sysparm_suppress_pagination_header | suppressPaginationHeader | - |
CamelServiceNowMinFields | String | sysparm_min_fields | - | - |
CamelServiceNowMaxFields | String | sysparm_max_fields | - | - |
CamelServiceNowSumFields | String | sysparm_sum_fields | - | - |
CamelServiceNowAvgFields | String | sysparm_avg_fields | - | - |
CamelServiceNowCount | Boolean | sysparm_count | - | - |
CamelServiceGroupBy | String | sysparm_group_by | - | - |
CamelServiceOrderBy | String | sysparm_order_by | - | - |
CamelServiceHaving | String | sysparm_having | - | - |
CamelServiceNowUUID | String | sysparm_uuid | - | - |
CamelServiceNowBreakdown | String | sysparm_breakdown | - | - |
CamelServiceNowIncludeScores | Boolean | sysparm_include_scores | includeScores | - |
CamelServiceNowIncludeScoreNotes | Boolean | sysparm_include_score_notes | includeScoreNotes | - |
CamelServiceNowIncludeAggregates | Boolean | sysparm_include_aggregates | includeAggregates | - |
CamelServiceNowIncludeAvailableBreakdowns | Boolean | sysparm_include_available_breakdowns | includeAvailableBreakdowns | - |
CamelServiceNowIncludeAvailableAggregates | Boolean | sysparm_include_available_aggregates | includeAvailableAggregates | - |
CamelServiceNowFavorites | Boolean | sysparm_favorites | favorites | - |
CamelServiceNowKey | Boolean | sysparm_key | key | - |
CamelServiceNowTarget | Boolean | sysparm_target | target | - |
CamelServiceNowDisplay | String | sysparm_display | display | - |
CamelServiceNowPerPage | Integer | sysparm_per_page | perPage | - |
CamelServiceNowSortBy | String | sysparm_sortby | sortBy | - |
CamelServiceNowSortDir | String | sysparm_sortdit | sortDir | - |
CamelServiceNowContains | String | sysparm_contains | - | - |
CamelServiceNowTags | String | sysparm_tags | - | - |
CamelServiceNowPage | String | sysparm_page | - | - |
CamelServiceNowElementsFilter | String | sysparm_elements_filter | - | - |
CamelServiceNowBreakdownRelation | String | sysparm_breakdown_relation | - | - |
CamelServiceNowDataSource | String | sysparm_data_source | - | - |
CamelServiceNowTopLevelOnly | Boolean | sysparm_top_level_only | topLevelOnly | - |
CamelServiceNowApiVersion | String | - | - | The REST API version |
CamelServiceNowResponseMeta | Map | - | - | Meta data provided along with a response |
Table 151. API Mapping
| CamelServiceNowResource | CamelServiceNowAction | Method | API URI |
|---|---|---|---|
TABLE | RETRIEVE | GET | /api/now/v1/table/{table_name}/{sys_id} |
CREATE | POST | /api/now/v1/table/{table_name} | |
MODIFY | PUT | /api/now/v1/table/{table_name}/{sys_id} | |
DELETE | DELETE | /api/now/v1/table/{table_name}/{sys_id} | |
UPDATE | PATCH | /api/now/v1/table/{table_name}/{sys_id} | |
AGGREGATE | RETRIEVE | GET | /api/now/v1/stats/{table_name} |
IMPORT | RETRIEVE | GET | /api/now/import/{table_name}/{sys_id} |
CREATE | POST | /api/now/import/{table_name} |
Table 152. API Mapping
| CamelServiceNowResource | CamelServiceNowAction | CamelServiceNowActionSubject | Method | API URI |
|---|---|---|---|---|
TABLE | RETRIEVE | GET | /api/now/v1/table/{table_name}/{sys_id} | |
CREATE | POST | /api/now/v1/table/{table_name} | ||
MODIFY | PUT | /api/now/v1/table/{table_name}/{sys_id} | ||
DELETE | DELETE | /api/now/v1/table/{table_name}/{sys_id} | ||
UPDATE | PATCH | /api/now/v1/table/{table_name}/{sys_id} | ||
AGGREGATE | RETRIEVE | GET | /api/now/v1/stats/{table_name} | |
IMPORT | RETRIEVE | GET | /api/now/import/{table_name}/{sys_id} | |
CREATE | POST | /api/now/import/{table_name} | ||
ATTACHMENT | RETRIEVE | GET | /api/now/api/now/attachment/{sys_id} | |
CONTENT | GET | /api/now/attachment/{sys_id}/file | ||
UPLOAD | POST | /api/now/api/now/attachment/file | ||
DELETE | DELETE | /api/now/attachment/{sys_id} | ||
SCORECARDS | RETRIEVE | PERFORMANCE_ANALYTICS | GET | /api/now/pa/scorecards |
MISC | RETRIEVE | USER_ROLE_INHERITANCE | GET | /api/global/user_role_inheritance |
CREATE | IDENTIFY_RECONCILE | POST | /api/now/identifyreconcile | |
SERVICE_CATALOG | RETRIEVE | GET | /sn_sc/servicecatalog/catalogs/{sys_id} | |
RETRIEVE | CATEGORIES | GET | /sn_sc/servicecatalog/catalogs/{sys_id}/categories | |
SERVICE_CATALOG_ITEMS | RETRIEVE | GET | /sn_sc/servicecatalog/items/{sys_id} | |
RETRIEVE | SUBMIT_GUIDE | POST | /sn_sc/servicecatalog/items/{sys_id}/submit_guide | |
RETRIEVE | CHECKOUT_GUIDE | POST | /sn_sc/servicecatalog/items/{sys_id}/checkout_guide | |
CREATE | SUBJECT_CART | POST | /sn_sc/servicecatalog/items/{sys_id}/add_to_cart | |
CREATE | SUBJECT_PRODUCER | POST | /sn_sc/servicecatalog/items/{sys_id}/submit_producer | |
SERVICE_CATALOG_CARTS | RETRIEVE | GET | /sn_sc/servicecatalog/cart | |
RETRIEVE | DELIVERY_ADDRESS | GET | /sn_sc/servicecatalog/cart/delivery_address/{user_id} | |
RETRIEVE | CHECKOUT | POST | /sn_sc/servicecatalog/cart/checkout | |
UPDATE | POST | /sn_sc/servicecatalog/cart/{cart_item_id} | ||
UPDATE | CHECKOUT | POST | /sn_sc/servicecatalog/cart/submit_order | |
DELETE | DELETE | /sn_sc/servicecatalog/cart/{sys_id}/empty | ||
SERVICE_CATALOG_CATEGORIES | RETRIEVE | GET | /sn_sc/servicecatalog/categories/{sys_id} |
{% raw %}
Retrieve 10 Incidents.
context.addRoutes(new RouteBuilder() {
public void configure() {
from("direct:servicenow")
.to("servicenow:{{env:SERVICENOW_INSTANCE}}"
+ "?userName={{env:SERVICENOW_USERNAME}}"
+ "&password={{env:SERVICENOW_PASSWORD}}"
+ "&oauthClientId={{env:SERVICENOW_OAUTH2_CLIENT_ID}}"
+ "&oauthClientSecret={{env:SERVICENOW_OAUTH2_CLIENT_SECRET}}"
.to("mock:servicenow");
}
});
FluentProducerTemplate.on(context)
.withHeader(ServiceNowConstants.RESOURCE, "table")
.withHeader(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_RETRIEVE)
.withHeader(ServiceNowConstants.SYSPARM_LIMIT.getId(), "10")
.withHeader(ServiceNowConstants.TABLE, "incident")
.withHeader(ServiceNowConstants.MODEL, Incident.class)
.to("direct:servicenow")
.send();
{% endraw %}