ServiceNow
Since Camel 2.18
Only producer is supported
The ServiceNow component provides access to ServiceNow platform through their REST API.
The component supports multiple version of ServiceNow platform with default to Helsinki.
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>
Configuring Options
Camel components are configured on two separate levels:
-
component level
-
endpoint level
Configuring Component Options
The component level is the highest level which holds general and common configurations that are inherited by the endpoints. For example a component may have security settings, credentials for authentication, urls for network connection and so forth.
Some components only have a few options, and others may have many. Because components typically have pre configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.
Configuring components can be done with the Component DSL, in a configuration file (application.properties|yaml), or directly with Java code.
Configuring Endpoint Options
Where you find yourself configuring the most is on endpoints, as endpoints often have many options, which allows you to configure what you need the endpoint to do. The options are also categorized into whether the endpoint is used as consumer (from) or as a producer (to), or used for both.
Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and DataFormat DSL as a type safe way of configuring endpoints and data formats in Java.
A good practice when configuring options is to use Property Placeholders, which allows to not hardcode urls, port numbers, sensitive information, and other settings. In other words placeholders allows to externalize the configuration from your code, and gives more flexibility and reuse.
The following two sections lists all the options, firstly for the component followed by the endpoint.
Component Options
The ServiceNow component supports 48 options, which are listed below.
Name | Description | Default | Type |
---|---|---|---|
Component configuration. |
ServiceNowConfiguration |
||
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. Enum values:
|
true |
String |
|
Return the display value (true), actual value (false), or both (all) for reference fields (default: false). Enum values:
|
false |
String |
|
True to exclude Table API links for reference fields (default: false). |
Boolean |
||
Set this parameter to true to return only scorecards that are favorites of the querying user. |
Boolean |
||
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. |
Boolean |
||
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. |
Boolean |
||
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. |
Boolean |
||
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. |
Boolean |
||
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. |
Boolean |
||
True to set raw value of input fields (default: false). |
Boolean |
||
Set this parameter to true to return only scorecards for key indicators. |
Boolean |
||
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. |
false |
boolean |
|
Defines both request and response models. |
Map |
||
Enter the maximum number of scorecards each query can return. By default this value is 10, and the maximum is 100. |
10 |
Integer |
|
The ServiceNow release to target, default to Helsinki See https://docs.servicenow.com. Enum values:
|
HELSINKI |
ServiceNowRelease |
|
Defines the request model. |
Map |
||
The default resource, can be overridden by header CamelServiceNowResource. |
String |
||
Defines the response model. |
Map |
||
Specify the value to use when sorting results. By default, queries sort records by value. Enum values:
|
String |
||
Specify the sort direction, ascending or descending. By default, queries sort records in descending order. Use sysparm_sortdir=asc to sort in ascending order. Enum values:
|
String |
||
True to suppress auto generation of system fields (default: false). |
Boolean |
||
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. |
Boolean |
||
The default table, can be overridden by header CamelServiceNowTable. |
String |
||
Set this parameter to true to return only scorecards that have a target. |
Boolean |
||
Gets only those categories whose parent is a catalog. |
Boolean |
||
The ServiceNow REST API version, default latest. |
String |
||
Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. |
true |
boolean |
|
The date format used for Json serialization/deserialization. |
yyyy-MM-dd |
String |
|
The date-time format used for Json serialization/deserialization. |
yyyy-MM-dd HH:mm:ss |
String |
|
To configure http-client. |
HTTPClientPolicy |
||
The ServiceNow instance name. |
String |
||
Sets Jackson’s ObjectMapper to use for request/reply. |
ObjectMapper |
||
To configure proxy authentication. |
ProxyAuthorizationPolicy |
||
Set this parameter to true to retrieve the target record when using import set api. The import set result is then replaced by the target record. |
false |
Boolean |
|
The time format used for Json serialization/deserialization. |
HH:mm:ss |
String |
|
The proxy host name. |
String |
||
The proxy port number. |
Integer |
||
The ServiceNow REST API url. |
String |
||
OAuth2 ClientID. |
String |
||
OAuth2 ClientSecret. |
String |
||
OAuth token Url. |
String |
||
Required ServiceNow account password, MUST be provided. |
String |
||
Password for proxy authentication. |
String |
||
Username for proxy authentication. |
String |
||
To configure security using SSLContextParameters. See http://camel.apache.org/camel-configuration-utilities.html. |
SSLContextParameters |
||
Enable usage of global SSL context parameters. |
false |
boolean |
|
Required ServiceNow user account name, MUST be provided. |
String |
Endpoint Options
The ServiceNow endpoint is configured using URI syntax:
servicenow:instanceName
with the following path and query parameters:
Path Parameters (1 parameters)
Name | Description | Default | Type |
---|---|---|---|
Required The ServiceNow instance name. |
String |
Query Parameters (44 parameters)
Name | Description | Default | Type |
---|---|---|---|
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. Enum values:
|
true |
String |
|
Return the display value (true), actual value (false), or both (all) for reference fields (default: false). Enum values:
|
false |
String |
|
True to exclude Table API links for reference fields (default: false). |
Boolean |
||
Set this parameter to true to return only scorecards that are favorites of the querying user. |
Boolean |
||
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. |
Boolean |
||
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. |
Boolean |
||
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. |
Boolean |
||
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. |
Boolean |
||
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. |
Boolean |
||
True to set raw value of input fields (default: false). |
Boolean |
||
Set this parameter to true to return only scorecards for key indicators. |
Boolean |
||
Defines both request and response models. |
Map |
||
Enter the maximum number of scorecards each query can return. By default this value is 10, and the maximum is 100. |
10 |
Integer |
|
The ServiceNow release to target, default to Helsinki See https://docs.servicenow.com. Enum values:
|
HELSINKI |
ServiceNowRelease |
|
Defines the request model. |
Map |
||
The default resource, can be overridden by header CamelServiceNowResource. |
String |
||
Defines the response model. |
Map |
||
Specify the value to use when sorting results. By default, queries sort records by value. Enum values:
|
String |
||
Specify the sort direction, ascending or descending. By default, queries sort records in descending order. Use sysparm_sortdir=asc to sort in ascending order. Enum values:
|
String |
||
True to suppress auto generation of system fields (default: false). |
Boolean |
||
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. |
Boolean |
||
The default table, can be overridden by header CamelServiceNowTable. |
String |
||
Set this parameter to true to return only scorecards that have a target. |
Boolean |
||
Gets only those categories whose parent is a catalog. |
Boolean |
||
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. |
false |
boolean |
|
The ServiceNow REST API version, default latest. |
String |
||
The date format used for Json serialization/deserialization. |
yyyy-MM-dd |
String |
|
The date-time format used for Json serialization/deserialization. |
yyyy-MM-dd HH:mm:ss |
String |
|
To configure http-client. |
HTTPClientPolicy |
||
Sets Jackson’s ObjectMapper to use for request/reply. |
ObjectMapper |
||
To configure proxy authentication. |
ProxyAuthorizationPolicy |
||
Set this parameter to true to retrieve the target record when using import set api. The import set result is then replaced by the target record. |
false |
Boolean |
|
The time format used for Json serialization/deserialization. |
HH:mm:ss |
String |
|
The proxy host name. |
String |
||
The proxy port number. |
Integer |
||
The ServiceNow REST API url. |
String |
||
OAuth2 ClientID. |
String |
||
OAuth2 ClientSecret. |
String |
||
OAuth token Url. |
String |
||
Required ServiceNow account password, MUST be provided. |
String |
||
Password for proxy authentication. |
String |
||
Username for proxy authentication. |
String |
||
To configure security using SSLContextParameters. See http://camel.apache.org/camel-configuration-utilities.html. |
SSLContextParameters |
||
Required ServiceNow user account name, MUST be provided. |
String |
Message Headers
The ServiceNow component supports 63 message header(s), which is/are listed below:
Name | Description | Default | Type |
---|---|---|---|
CamelServiceNowResource (producer) Constant: |
The resource to access. |
String |
|
CamelServiceNowAction (producer) Constant: |
The action to perform. |
String |
|
CamelServiceNowActionSubject (producer) Constant: |
The action subject. |
String |
|
CamelServiceNowModel (producer) Constant: |
The data model. |
Class |
|
CamelServiceNowRequestModel (producer) Constant: |
The request data model. |
Class |
|
CamelServiceNowResponseModel (producer) Constant: |
The response data model. |
Class |
|
CamelServiceNowContentType (producer) Constant: |
The content type. |
String |
|
CamelServiceNowContentMeta (producer) Constant: |
The content meta. |
Map |
|
CamelServiceNowResponseMeta (producer) Constant: |
The response meta. |
Map |
|
CamelServiceNowApiVersion (producer) Constant: |
The REST API version. |
String |
|
CamelServiceNowResponseType (producer) Constant: |
The type of the response. |
Class |
|
CamelServiceNowRetrieveTargetRecord (producer) Constant: |
Set this parameter to true to retrieve the target record. |
Boolean |
|
CamelServiceNowTable (producer) Constant: |
The default table. |
String |
|
CamelServiceNowSysId (producer) Constant: |
The sys id. |
String |
|
CamelServiceNowUserSysId (producer) Constant: |
The user sys id. |
String |
|
CamelServiceNowUserId (producer) Constant: |
The user id. |
String |
|
CamelServiceNowCartItemId (producer) Constant: |
The cart item id. |
String |
|
CamelServiceNowFileName (producer) Constant: |
The file name. |
String |
|
CamelServiceNowTableSysId (producer) Constant: |
The table sys id. |
String |
|
CamelServiceNowEncryptionContext (producer) Constant: |
The encryption context. |
String |
|
CamelServiceNowCategory (producer) Constant: |
The sys param category. |
String |
|
CamelServiceNowType (producer) Constant: |
The sys param type. |
String |
|
CamelServiceNowCatalog (producer) Constant: |
The sys param catalog. |
String |
|
CamelServiceNowQuery (producer) Constant: |
The sys param query. |
String |
|
CamelServiceNowDisplayValue (producer) Constant: |
Return the display value (true), actual value (false), or both (all) for reference fields. |
false |
String |
CamelServiceNowInputDisplayValue (producer) Constant: |
True to set raw value of input fields. |
false |
Boolean |
CamelServiceNowExcludeReferenceLink (producer) Constant: |
True to exclude Table API links for reference fields. |
false |
Boolean |
CamelServiceNowFields (producer) Constant: |
The sys param fields. |
String |
|
CamelServiceNowLimit (producer) Constant: |
The sys param limit. |
Integer |
|
CamelServiceNowText (producer) Constant: |
The sys param text. |
String |
|
CamelServiceNowOffset (producer) Constant: |
The sys param offset. |
Integer |
|
CamelServiceNowView (producer) Constant: |
The sys param view. |
String |
|
CamelServiceNowSuppressAutoSysField (producer) Constant: |
True to suppress auto generation of system fields. |
false |
Boolean |
CamelServiceNowSuppressPaginationHeader (producer) Constant: |
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. |
Boolean |
|
CamelServiceNowMinFields (producer) Constant: |
The sys param min fields. |
String |
|
CamelServiceNowMaxFields (producer) Constant: |
The sys param max fields. |
String |
|
CamelServiceNowSumFields (producer) Constant: |
The sys param sum fields. |
String |
|
CamelServiceNowAvgFields (producer) Constant: |
The sys param avg fields. |
String |
|
CamelServiceNowCount (producer) Constant: |
The sys param count. |
Boolean |
|
CamelServiceNowGroupBy (producer) Constant: |
The sys param group by. |
String |
|
CamelServiceNowOrderBy (producer) Constant: |
The sys param order by. |
String |
|
CamelServiceNowHaving (producer) Constant: |
The sys param having. |
String |
|
CamelServiceNowUUID (producer) Constant: |
The sys param UUID. |
String |
|
CamelServiceNowBreakdown (producer) Constant: |
The sys param breakdown. |
String |
|
CamelServiceNowIncludeScores (producer) Constant: |
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. |
Boolean |
|
CamelServiceNowIncludeScoreNotes (producer) Constant: |
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. |
Boolean |
|
CamelServiceNowIncludeAggregates (producer) Constant: |
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. |
Boolean |
|
CamelServiceNowIncludeAvailableBreakdowns (producer) Constant: |
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. |
Boolean |
|
CamelServiceNowIncludeAvailableAggregates (producer) Constant: |
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. |
Boolean |
|
CamelServiceNowFavorites (producer) Constant: |
Set this parameter to true to return only scorecards that are favorites of the querying user. |
Boolean |
|
Constant: |
Set this parameter to true to return only scorecards for key indicators. |
Boolean |
|
CamelServiceNowTarget (producer) Constant: |
Set this parameter to true to return only scorecards that have a target. |
Boolean |
|
CamelServiceNowDisplay (producer) Constant: |
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. |
true |
String |
CamelServiceNowPerPage (producer) Constant: |
Enter the maximum number of scorecards each query can return. By default this value is 10, and the maximum is 100. |
10 |
Integer |
CamelServiceNowSortBy (producer) Constant: |
Specify the value to use when sorting results. By default, queries sort records by value. |
String |
|
CamelServiceNowSortDir (producer) Constant: |
Specify the sort direction, ascending or descending. By default, queries sort records in descending order. Use sysparm_sortdir=asc to sort in ascending order. |
String |
|
CamelServiceNowContains (producer) Constant: |
The sys param contains. |
String |
|
CamelServiceNowTags (producer) Constant: |
The sys param tags. |
String |
|
CamelServiceNowPage (producer) Constant: |
The sys param page. |
String |
|
CamelServiceNowElementsFilter (producer) Constant: |
The sys param elements filter. |
String |
|
CamelServiceNowBreakdownRelation (producer) Constant: |
The sys param breakdown relation. |
String |
|
CamelServiceNowDataSource (producer) Constant: |
The sys param data source. |
String |
|
CamelServiceNowTopLevelOnly (producer) Constant: |
Gets only those categories whose parent is a catalog. |
Boolean |
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} |
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} |
Usage examples:
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();