Camel Components

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 versions 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>

URI format

servicenow://instanceName?[options]

Configuring Options

Camel components are configured on two separate levels:

  • component level

  • endpoint level

Configuring Component Options

At the component level, you set general and shared configurations that are, then, inherited by the endpoints. It is the highest configuration level.

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.

You can configure components using:

  • the Component DSL.

  • in a configuration file (application.properties, *.yaml files, etc).

  • directly in the Java code.

Configuring Endpoint Options

You usually spend more time setting up endpoints because they have many options. These options help you customize what you want the endpoint to do. The options are also categorized into whether the endpoint is used as a consumer (from), as a producer (to), or 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.

Property placeholders provide a few benefits:

  • They help prevent using hardcoded urls, port numbers, sensitive information, and other settings.

  • They allow externalizing the configuration from the code.

  • They help the code to become more flexible and reusable.

The following two sections list all the options, firstly for the component followed by the endpoint.

Component Options

The ServiceNow component supports the following options which are listed below.

Name Description Default Type

configuration (producer)

The shared configuration of the endpoints. Each endpoint starts from a copy of it.

ServiceNowConfiguration

display (producer)

Which scorecards a scorecards request returns by the Display field of their indicator: true for only those with Display selected, all for any (sysparm_display). The CamelServiceNowDisplay header replaces this option.

Enum values:

  • false

  • true

  • all

true

String

displayValue (producer)

Whether ServiceNow returns the display values (true), the actual values (false) or both (all) of the fields (sysparm_display_value). The CamelServiceNowDisplayValue header replaces this option.

Enum values:

  • false

  • true

  • all

false

String

excludeReferenceLink (producer)

Whether ServiceNow leaves out the Table API links of reference fields in the response (sysparm_exclude_reference_link). The CamelServiceNowExcludeReferenceLink header replaces this option.

false

Boolean

favorites (producer)

Whether a scorecards request returns only the scorecards that are favorites of the user (sysparm_favorites). The CamelServiceNowFavorites header replaces this option.

Boolean

includeAggregates (producer)

Whether a scorecards request returns all available aggregates of an indicator, also when an aggregate is already applied (sysparm_include_aggregates). The CamelServiceNowIncludeAggregates header replaces this option.

false

Boolean

includeAvailableAggregates (producer)

Whether a scorecards request returns all available aggregates of an indicator when no aggregate is applied (sysparm_include_available_aggregates). The CamelServiceNowIncludeAvailableAggregates header replaces this option.

false

Boolean

includeAvailableBreakdowns (producer)

Whether a scorecards request returns all available breakdowns of an indicator (sysparm_include_available_breakdowns). The CamelServiceNowIncludeAvailableBreakdowns header replaces this option.

false

Boolean

includeScoreNotes (producer)

Whether a scorecards request returns the notes of each score, with their text, author and time (sysparm_include_score_notes). The CamelServiceNowIncludeScoreNotes header replaces this option.

false

Boolean

includeScores (producer)

Whether a scorecards request returns all scores of a scorecard instead of only the most recent one (sysparm_include_scores). The CamelServiceNowIncludeScores header replaces this option.

false

Boolean

inputDisplayValue (producer)

Whether ServiceNow treats the field values of a create or change as display values instead of actual values (sysparm_input_display_value). The CamelServiceNowInputDisplayValue header replaces this option.

false

Boolean

key (producer)

Whether a scorecards request returns only the scorecards of key indicators (sysparm_key). The CamelServiceNowKey header replaces this option.

Boolean

lazyStartProducer (producer)

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

models (producer)

The model class per table name, used for both the request and the response. A table with no class uses a Map. The CamelServiceNowModel header replaces this option. This is a multi-value option with prefix: model.

Map

perPage (producer)

The maximum number of scorecards that a scorecards request returns per page, at most 100 (sysparm_per_page). The CamelServiceNowPerPage header replaces this option.

10

Integer

release (producer)

The ServiceNow release whose REST APIs the producer calls. FUJI supports the table, aggregate and import resources, and HELSINKI all resources. GENEVA is not supported.

Enum values:

  • FUJI

  • GENEVA

  • HELSINKI

HELSINKI

ServiceNowRelease

requestModels (producer)

The class of the request body per table name. The producer fails when the body is not an instance of it, and a table with no class uses a Map. The CamelServiceNowRequestModel and CamelServiceNowModel headers replace this option. This is a multi-value option with prefix: request-model.

Map

resource (producer)

The REST API that the producer calls when the CamelServiceNowResource header is not set: table, aggregate, import, attachment, scorecards, misc, service_catalog, service_catalog_items, service_catalog_cart or service_catalog_categories. The FUJI release supports only table, aggregate and import.

String

responseModels (producer)

The class per table name that the producer converts the result to. A table with no class uses a Map. The CamelServiceNowResponseModel and CamelServiceNowModel headers replace this option. This is a multi-value option with prefix: response-model.

Map

sortBy (producer)

The value that a scorecards request sorts the scorecards by (sysparm_sortby). If not set, ServiceNow sorts by value. The CamelServiceNowSortBy header replaces this option.

Enum values:

  • value

  • change

  • changeperc

  • gap

  • gapperc

  • duedate

  • name

  • order

  • default

  • group

  • indicator_group

  • frequency

  • target

  • date

  • trend

  • bullet

  • direction

String

sortDir (producer)

The sort direction of a scorecards request, asc or desc (sysparm_sortdir). If not set, ServiceNow sorts in descending order. The CamelServiceNowSortDir header replaces this option.

Enum values:

  • asc

  • desc

String

suppressAutoSysField (producer)

Whether ServiceNow does not generate the system fields, such as sys_updated_on, when a record is created or changed (sysparm_suppress_auto_sys_field). The CamelServiceNowSuppressAutoSysField header replaces this option.

false

Boolean

suppressPaginationHeader (producer)

Whether ServiceNow leaves out the Link header of the response (sysparm_suppress_pagination_header), from which the producer sets the CamelServiceNowOffsetNext, CamelServiceNowOffsetPrev, CamelServiceNowOffsetFirst and CamelServiceNowOffsetLast headers. The CamelServiceNowSuppressPaginationHeader header replaces this option.

false

Boolean

table (producer)

The name of the table, for example incident, for the table, aggregate and import resources. The CamelServiceNowTable header replaces this option. The table name also selects the class of the models, requestModels and responseModels options.

String

target (producer)

Whether a scorecards request returns only the scorecards that have a target (sysparm_target). The CamelServiceNowTarget header replaces this option.

Boolean

topLevelOnly (producer)

Whether the categories of a catalog (the categories subject of the service_catalog resource) are only those whose parent is the catalog (sysparm_top_level_only). The CamelServiceNowTopLevelOnly header replaces this option.

Boolean

apiVersion (advanced)

The version of the REST API, for example v1, which the producer adds to the request path. If not set, the path has no version and ServiceNow uses the latest one. The CamelServiceNowApiVersion header replaces this option.

String

autowiredEnabled (advanced)

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

dateFormat (advanced)

The java.time.format.DateTimeFormatter pattern of the LocalDate fields of the models in the JSON. It is not used when the mapper option is set.

yyyy-MM-dd

String

dateTimeFormat (advanced)

The java.time.format.DateTimeFormatter pattern of the LocalDateTime fields of the models in the JSON. It is not used when the mapper option is set.

yyyy-MM-dd HH:mm:ss

String

httpClientPolicy (advanced)

To use a custom Apache CXF org.apache.cxf.transports.http.configuration.HTTPClientPolicy for the HTTP connection, for example for timeouts. When it is set, the proxyHost and proxyPort options are not used.

HTTPClientPolicy

instanceName (advanced)

The name of the ServiceNow instance for the endpoints whose URI does not name one.

String

mapper (advanced)

To use a custom Jackson tools.jackson.databind.ObjectMapper, which must be a JsonMapper, to convert the request and the response. When it is set, the dateFormat, timeFormat and dateTimeFormat options are not used.

ObjectMapper

proxyAuthorizationPolicy (advanced)

To use a custom Apache CXF org.apache.cxf.configuration.security.ProxyAuthorizationPolicy for the authentication to the proxy. When it is set, the proxyUserName and proxyPassword options are not used.

ProxyAuthorizationPolicy

retrieveTargetRecordOnImport (advanced)

Whether the create action of the import resource returns the record that the import inserted into the target table, which the producer reads with a second request, instead of the import set result. The CamelServiceNowRetrieveTargetRecord header replaces this option.

false

Boolean

timeFormat (advanced)

The java.time.format.DateTimeFormatter pattern of the LocalTime fields of the models in the JSON. It is not used when the mapper option is set.

HH:mm:ss

String

proxyHost (proxy)

The host name of the HTTP proxy. The proxy is used only when proxyPort is also set and httpClientPolicy is not set.

String

proxyPort (proxy)

The port of the HTTP proxy, used with proxyHost.

Integer

apiUrl (security)

The base URL of the ServiceNow REST API. If not set, https://{instanceName}.service-now.com/api is used.

String

oauthClientId (security)

The client ID of the OAuth application in ServiceNow. When it and oauthClientSecret are set, the producer gets an access token from oauthTokenUrl with the password grant of userName and password, and sends the token instead of basic authentication.

String

oauthClientSecret (security)

The client secret of the OAuth application in ServiceNow, used with oauthClientId.

String

oauthTokenUrl (security)

The URL of the OAuth token endpoint of ServiceNow. If not set, https://{instanceName}.service-now.com/oauth_token.do is used.

String

password (security)

Required The password of the ServiceNow account, used with userName.

String

proxyPassword (security)

The password for basic authentication to the proxy, used with proxyUserName.

String

proxyUserName (security)

The user name for basic authentication to the proxy. It is used only when proxyPassword is also set and proxyAuthorizationPolicy is not set.

String

sslContextParameters (security)

The TLS configuration of the connection to the REST API. If not set and useGlobalSslContextParameters is enabled on the component, the global SSL context parameters are used.

SSLContextParameters

useGlobalSslContextParameters (security)

Whether to use the global SSL context parameters of the CamelContext when the sslContextParameters option is not set.

false

boolean

userName (security)

Required The user name of the ServiceNow account. The producer sends it with basic authentication, or in the OAuth password grant when oauthClientId and oauthClientSecret are set.

String

Endpoint Options

The ServiceNow endpoint is configured using URI syntax:

servicenow:instanceName

With the following path and query parameters:

Path Parameters

Name Description Default Type

instanceName (producer)

Required The name of the ServiceNow instance, the first part of its host name {instanceName}.service-now.com. The producer builds the default apiUrl and oauthTokenUrl from it.

String

Query Parameters

Name Description Default Type

display (producer)

Which scorecards a scorecards request returns by the Display field of their indicator: true for only those with Display selected, all for any (sysparm_display). The CamelServiceNowDisplay header replaces this option.

Enum values:

  • false

  • true

  • all

true

String

displayValue (producer)

Whether ServiceNow returns the display values (true), the actual values (false) or both (all) of the fields (sysparm_display_value). The CamelServiceNowDisplayValue header replaces this option.

Enum values:

  • false

  • true

  • all

false

String

excludeReferenceLink (producer)

Whether ServiceNow leaves out the Table API links of reference fields in the response (sysparm_exclude_reference_link). The CamelServiceNowExcludeReferenceLink header replaces this option.

false

Boolean

favorites (producer)

Whether a scorecards request returns only the scorecards that are favorites of the user (sysparm_favorites). The CamelServiceNowFavorites header replaces this option.

Boolean

includeAggregates (producer)

Whether a scorecards request returns all available aggregates of an indicator, also when an aggregate is already applied (sysparm_include_aggregates). The CamelServiceNowIncludeAggregates header replaces this option.

false

Boolean

includeAvailableAggregates (producer)

Whether a scorecards request returns all available aggregates of an indicator when no aggregate is applied (sysparm_include_available_aggregates). The CamelServiceNowIncludeAvailableAggregates header replaces this option.

false

Boolean

includeAvailableBreakdowns (producer)

Whether a scorecards request returns all available breakdowns of an indicator (sysparm_include_available_breakdowns). The CamelServiceNowIncludeAvailableBreakdowns header replaces this option.

false

Boolean

includeScoreNotes (producer)

Whether a scorecards request returns the notes of each score, with their text, author and time (sysparm_include_score_notes). The CamelServiceNowIncludeScoreNotes header replaces this option.

false

Boolean

includeScores (producer)

Whether a scorecards request returns all scores of a scorecard instead of only the most recent one (sysparm_include_scores). The CamelServiceNowIncludeScores header replaces this option.

false

Boolean

inputDisplayValue (producer)

Whether ServiceNow treats the field values of a create or change as display values instead of actual values (sysparm_input_display_value). The CamelServiceNowInputDisplayValue header replaces this option.

false

Boolean

key (producer)

Whether a scorecards request returns only the scorecards of key indicators (sysparm_key). The CamelServiceNowKey header replaces this option.

Boolean

models (producer)

The model class per table name, used for both the request and the response. A table with no class uses a Map. The CamelServiceNowModel header replaces this option. This is a multi-value option with prefix: model.

Map

perPage (producer)

The maximum number of scorecards that a scorecards request returns per page, at most 100 (sysparm_per_page). The CamelServiceNowPerPage header replaces this option.

10

Integer

release (producer)

The ServiceNow release whose REST APIs the producer calls. FUJI supports the table, aggregate and import resources, and HELSINKI all resources. GENEVA is not supported.

Enum values:

  • FUJI

  • GENEVA

  • HELSINKI

HELSINKI

ServiceNowRelease

requestModels (producer)

The class of the request body per table name. The producer fails when the body is not an instance of it, and a table with no class uses a Map. The CamelServiceNowRequestModel and CamelServiceNowModel headers replace this option. This is a multi-value option with prefix: request-model.

Map

resource (producer)

The REST API that the producer calls when the CamelServiceNowResource header is not set: table, aggregate, import, attachment, scorecards, misc, service_catalog, service_catalog_items, service_catalog_cart or service_catalog_categories. The FUJI release supports only table, aggregate and import.

String

responseModels (producer)

The class per table name that the producer converts the result to. A table with no class uses a Map. The CamelServiceNowResponseModel and CamelServiceNowModel headers replace this option. This is a multi-value option with prefix: response-model.

Map

sortBy (producer)

The value that a scorecards request sorts the scorecards by (sysparm_sortby). If not set, ServiceNow sorts by value. The CamelServiceNowSortBy header replaces this option.

Enum values:

  • value

  • change

  • changeperc

  • gap

  • gapperc

  • duedate

  • name

  • order

  • default

  • group

  • indicator_group

  • frequency

  • target

  • date

  • trend

  • bullet

  • direction

String

sortDir (producer)

The sort direction of a scorecards request, asc or desc (sysparm_sortdir). If not set, ServiceNow sorts in descending order. The CamelServiceNowSortDir header replaces this option.

Enum values:

  • asc

  • desc

String

suppressAutoSysField (producer)

Whether ServiceNow does not generate the system fields, such as sys_updated_on, when a record is created or changed (sysparm_suppress_auto_sys_field). The CamelServiceNowSuppressAutoSysField header replaces this option.

false

Boolean

suppressPaginationHeader (producer)

Whether ServiceNow leaves out the Link header of the response (sysparm_suppress_pagination_header), from which the producer sets the CamelServiceNowOffsetNext, CamelServiceNowOffsetPrev, CamelServiceNowOffsetFirst and CamelServiceNowOffsetLast headers. The CamelServiceNowSuppressPaginationHeader header replaces this option.

false

Boolean

table (producer)

The name of the table, for example incident, for the table, aggregate and import resources. The CamelServiceNowTable header replaces this option. The table name also selects the class of the models, requestModels and responseModels options.

String

target (producer)

Whether a scorecards request returns only the scorecards that have a target (sysparm_target). The CamelServiceNowTarget header replaces this option.

Boolean

topLevelOnly (producer)

Whether the categories of a catalog (the categories subject of the service_catalog resource) are only those whose parent is the catalog (sysparm_top_level_only). The CamelServiceNowTopLevelOnly header replaces this option.

Boolean

lazyStartProducer (producer (advanced))

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

apiVersion (advanced)

The version of the REST API, for example v1, which the producer adds to the request path. If not set, the path has no version and ServiceNow uses the latest one. The CamelServiceNowApiVersion header replaces this option.

String

dateFormat (advanced)

The java.time.format.DateTimeFormatter pattern of the LocalDate fields of the models in the JSON. It is not used when the mapper option is set.

yyyy-MM-dd

String

dateTimeFormat (advanced)

The java.time.format.DateTimeFormatter pattern of the LocalDateTime fields of the models in the JSON. It is not used when the mapper option is set.

yyyy-MM-dd HH:mm:ss

String

httpClientPolicy (advanced)

To use a custom Apache CXF org.apache.cxf.transports.http.configuration.HTTPClientPolicy for the HTTP connection, for example for timeouts. When it is set, the proxyHost and proxyPort options are not used.

HTTPClientPolicy

mapper (advanced)

To use a custom Jackson tools.jackson.databind.ObjectMapper, which must be a JsonMapper, to convert the request and the response. When it is set, the dateFormat, timeFormat and dateTimeFormat options are not used.

ObjectMapper

proxyAuthorizationPolicy (advanced)

To use a custom Apache CXF org.apache.cxf.configuration.security.ProxyAuthorizationPolicy for the authentication to the proxy. When it is set, the proxyUserName and proxyPassword options are not used.

ProxyAuthorizationPolicy

retrieveTargetRecordOnImport (advanced)

Whether the create action of the import resource returns the record that the import inserted into the target table, which the producer reads with a second request, instead of the import set result. The CamelServiceNowRetrieveTargetRecord header replaces this option.

false

Boolean

timeFormat (advanced)

The java.time.format.DateTimeFormatter pattern of the LocalTime fields of the models in the JSON. It is not used when the mapper option is set.

HH:mm:ss

String

proxyHost (proxy)

The host name of the HTTP proxy. The proxy is used only when proxyPort is also set and httpClientPolicy is not set.

String

proxyPort (proxy)

The port of the HTTP proxy, used with proxyHost.

Integer

apiUrl (security)

The base URL of the ServiceNow REST API. If not set, https://{instanceName}.service-now.com/api is used.

String

oauthClientId (security)

The client ID of the OAuth application in ServiceNow. When it and oauthClientSecret are set, the producer gets an access token from oauthTokenUrl with the password grant of userName and password, and sends the token instead of basic authentication.

String

oauthClientSecret (security)

The client secret of the OAuth application in ServiceNow, used with oauthClientId.

String

oauthTokenUrl (security)

The URL of the OAuth token endpoint of ServiceNow. If not set, https://{instanceName}.service-now.com/oauth_token.do is used.

String

password (security)

Required The password of the ServiceNow account, used with userName.

String

proxyPassword (security)

The password for basic authentication to the proxy, used with proxyUserName.

String

proxyUserName (security)

The user name for basic authentication to the proxy. It is used only when proxyPassword is also set and proxyAuthorizationPolicy is not set.

String

sslContextParameters (security)

The TLS configuration of the connection to the REST API. If not set and useGlobalSslContextParameters is enabled on the component, the global SSL context parameters are used.

SSLContextParameters

userName (security)

Required The user name of the ServiceNow account. The producer sends it with basic authentication, or in the OAuth password grant when oauthClientId and oauthClientSecret are set.

String

Message Headers

The ServiceNow component supports the following message header(s), which is/are listed below:

Name Description Default Type

CamelServiceNowResource (producer)

Constant: RESOURCE

The REST API to call: table, aggregate, import, attachment, scorecards, misc, service_catalog, service_catalog_items, service_catalog_cart or service_catalog_categories. It replaces the resource option.

String

CamelServiceNowAction (producer)

Constant: ACTION

The action to perform on the resource: retrieve, content, create, modify, delete, update or upload. For the table resource, modify replaces a record (PUT) and update changes only the fields in the body (PATCH).

String

CamelServiceNowActionSubject (producer)

Constant: ACTION_SUBJECT

The subject that selects the operation when a resource has several for the same action: categories, cart, producer, submit_guide, checkout_guide, performance_analytics, user_role_inheritance, identify_reconcile, delivery_address or checkout. The scorecards and misc resources always need one.

String

CamelServiceNowModel (producer)

Constant: MODEL

The class used as both the request model and the response model. It replaces the models option. After a call, the producer sets it to the name of the response model class if it is not set.

Class

CamelServiceNowRequestModel (producer)

Constant: REQUEST_MODEL

The class of the request body. The producer fails when the body is not an instance of it. It replaces the CamelServiceNowModel header and the requestModels option.

Class

CamelServiceNowResponseModel (producer)

Constant: RESPONSE_MODEL

The class that the producer converts the result to. It replaces the CamelServiceNowModel header and the responseModels option. After a call, the producer sets it to the name of the response model class if it is not set.

Class

CamelServiceNowContentType (producer)

Constant: CONTENT_TYPE

The content type of the file that the upload action of the attachment resource sends, which the upload requires. The producer sets it to the Content-Type of the response.

String

CamelServiceNowContentMeta (producer)

Constant: CONTENT_META

The metadata of the attachment as a Map, which the producer reads from the X-Attachment-Metadata header of the response of the content action.

Map

CamelServiceNowResponseMeta (producer)

Constant: RESPONSE_META

The fields of the response other than result, as a Map of their text values.

Map

CamelServiceNowApiVersion (producer)

Constant: API_VERSION

The version of the REST API, for example v1. It replaces the apiVersion option.

String

CamelServiceNowResponseType (producer)

Constant: RESPONSE_TYPE

The class of the body that the producer set from the result.

Class

CamelServiceNowRetrieveTargetRecord (producer)

Constant: RETRIEVE_TARGET_RECORD

Whether the create action of the import resource returns the record inserted into the target table instead of the import set result. It replaces the retrieveTargetRecordOnImport option.

Boolean

CamelServiceNowTable (producer)

Constant: PARAM_TABLE_NAME

The name of the table. It replaces the table option. For the upload action of the attachment resource, it is the table of the record to attach the file to (table_name).

String

CamelServiceNowSysId (producer)

Constant: PARAM_SYS_ID

The sys_id of the record, attachment, catalog, category, item or cart to act on. Without it, the retrieve action of the table and attachment resources lists the records.

String

CamelServiceNowUserSysId (producer)

Constant: PARAM_USER_SYS_ID

The sys_id of the user whose roles the user_role_inheritance subject of the misc resource returns (user_sysid).

String

CamelServiceNowUserId (producer)

Constant: PARAM_USER_ID

The ID of the user whose delivery address the delivery_address subject of the service_catalog_cart resource returns.

String

CamelServiceNowCartItemId (producer)

Constant: PARAM_CART_ITEM_ID

The ID of the cart item that the update action of the service_catalog_cart resource changes.

String

CamelServiceNowFileName (producer)

Constant: PARAM_FILE_NAME

The name of the file that the upload action of the attachment resource creates (file_name).

String

CamelServiceNowTableSysId (producer)

Constant: PARAM_TABLE_SYS_ID

The sys_id of the record that the upload action of the attachment resource attaches the file to (table_sys_id).

String

CamelServiceNowEncryptionContext (producer)

Constant: PARAM_ENCRYPTION_CONTEXT

The sys_id of the encryption context that the upload action of the attachment resource encrypts the file with (encryption_context).

String

CamelServiceNowCategory (producer)

Constant: SYSPARM_CATEGORY

The sys_id of the category to filter the service catalog items by (sysparm_category).

String

CamelServiceNowType (producer)

Constant: SYSPARM_TYPE

The type of the service catalog items to return (sysparm_type).

String

CamelServiceNowCatalog (producer)

Constant: SYSPARM_CATALOG

The sys_id of the catalog to filter the service catalog items by (sysparm_catalog).

String

CamelServiceNowQuery (producer)

Constant: SYSPARM_QUERY

The encoded query that filters the records, for example active=truepriority=1 (sysparm_query).

String

CamelServiceNowDisplayValue (producer)

Constant: SYSPARM_DISPLAY_VALUE

Whether ServiceNow returns the display values (true), the actual values (false) or both (all) of the fields. It replaces the displayValue option.

false

String

CamelServiceNowInputDisplayValue (producer)

Constant: SYSPARM_INPUT_DISPLAY_VALUE

Whether ServiceNow treats the field values of a create or change as display values. It replaces the inputDisplayValue option.

false

Boolean

CamelServiceNowExcludeReferenceLink (producer)

Constant: SYSPARM_EXCLUDE_REFERENCE_LINK

Whether ServiceNow leaves out the Table API links of reference fields. It replaces the excludeReferenceLink option.

false

Boolean

CamelServiceNowFields (producer)

Constant: SYSPARM_FIELDS

The comma-separated names of the fields to return (sysparm_fields).

String

CamelServiceNowLimit (producer)

Constant: SYSPARM_LIMIT

The maximum number of records to return (sysparm_limit).

Integer

CamelServiceNowText (producer)

Constant: SYSPARM_TEXT

The text to search the service catalog items for (sysparm_text).

String

CamelServiceNowOffset (producer)

Constant: SYSPARM_OFFSET

The index of the first record to return, for paging (sysparm_offset).

Integer

CamelServiceNowView (producer)

Constant: SYSPARM_VIEW

The UI view whose fields to return: desktop, mobile or both (sysparm_view).

String

CamelServiceNowSuppressAutoSysField (producer)

Constant: SYSPARM_SUPPRESS_AUTO_SYS_FIELD

Whether ServiceNow does not generate the system fields when a record is created or changed. It replaces the suppressAutoSysField option.

false

Boolean

CamelServiceNowSuppressPaginationHeader (producer)

Constant: SYSPARM_SUPPRESS_PAGINATION_HEADER

Whether ServiceNow leaves out the Link header of the response, from which the producer reads the paging offsets. It replaces the suppressPaginationHeader option.

Boolean

CamelServiceNowMinFields (producer)

Constant: SYSPARM_MIN_FIELDS

The comma-separated fields whose minimum the aggregate resource returns (sysparm_min_fields).

String

CamelServiceNowMaxFields (producer)

Constant: SYSPARM_MAX_FIELDS

The comma-separated fields whose maximum the aggregate resource returns (sysparm_max_fields).

String

CamelServiceNowSumFields (producer)

Constant: SYSPARM_SUM_FIELDS

The comma-separated fields whose sum the aggregate resource returns (sysparm_sum_fields).

String

CamelServiceNowAvgFields (producer)

Constant: SYSPARM_AVG_FIELDS

The comma-separated fields whose average the aggregate resource returns (sysparm_avg_fields).

String

CamelServiceNowCount (producer)

Constant: SYSPARM_COUNT

Whether the aggregate resource returns the number of records (sysparm_count).

Boolean

CamelServiceNowGroupBy (producer)

Constant: SYSPARM_GROUP_BY

The comma-separated fields to group the aggregate results by (sysparm_group_by).

String

CamelServiceNowOrderBy (producer)

Constant: SYSPARM_ORDER_BY

The comma-separated fields to order the aggregate groups by (sysparm_order_by).

String

CamelServiceNowHaving (producer)

Constant: SYSPARM_HAVING

The condition on an aggregate that the groups must meet, as aggregatefieldoperatorvalue, for example countpriority>3 (sysparm_having).

String

CamelServiceNowUUID (producer)

Constant: SYSPARM_UUID

The colon-separated sys_ids of the indicator, and optionally of its breakdown, element and aggregate, whose scorecards to return (sysparm_uuid).

String

CamelServiceNowBreakdown (producer)

Constant: SYSPARM_BREAKDOWN

The sys_id of the breakdown that organizes the returned scorecards (sysparm_breakdown).

String

CamelServiceNowIncludeScores (producer)

Constant: SYSPARM_INCLUDE_SCORES

Whether to return all scores of a scorecard instead of only the most recent one. It replaces the includeScores option.

Boolean

CamelServiceNowIncludeScoreNotes (producer)

Constant: SYSPARM_INCLUDE_SCORE_NOTES

Whether to return the notes of each score. It replaces the includeScoreNotes option.

Boolean

CamelServiceNowIncludeAggregates (producer)

Constant: SYSPARM_INCLUDE_AGGREGATES

Whether to return all available aggregates of an indicator, also when an aggregate is already applied. It replaces the includeAggregates option.

Boolean

CamelServiceNowIncludeAvailableBreakdowns (producer)

Constant: SYSPARM_INCLUDE_AVAILABLE_BREAKDOWNS

Whether to return all available breakdowns of an indicator. It replaces the includeAvailableBreakdowns option.

Boolean

CamelServiceNowIncludeAvailableAggregates (producer)

Constant: SYSPARM_INCLUDE_AVAILABLE_AGGREGATES

Whether to return all available aggregates of an indicator when no aggregate is applied. It replaces the includeAvailableAggregates option.

Boolean

CamelServiceNowFavorites (producer)

Constant: SYSPARM_FAVORITES

Whether to return only the scorecards that are favorites of the user. It replaces the favorites option.

Boolean

CamelServiceNowKey (producer)

Constant: SYSPARM_KEY

Whether to return only the scorecards of key indicators. It replaces the key option.

Boolean

CamelServiceNowTarget (producer)

Constant: SYSPARM_TARGET

Whether to return only the scorecards that have a target. It replaces the target option.

Boolean

CamelServiceNowDisplay (producer)

Constant: SYSPARM_DISPLAY

Which scorecards to return by the Display field of their indicator: true for only those with Display selected, all for any. It replaces the display option.

true

String

CamelServiceNowPerPage (producer)

Constant: SYSPARM_PER_PAGE

The maximum number of scorecards to return per page, at most 100. It replaces the perPage option.

10

Integer

CamelServiceNowSortBy (producer)

Constant: SYSPARM_SORT_BY

The value to sort the scorecards by. It replaces the sortBy option.

String

CamelServiceNowSortDir (producer)

Constant: SYSPARM_SORT_DIR

The sort direction of the scorecards, asc or desc. It replaces the sortDir option.

String

CamelServiceNowContains (producer)

Constant: SYSPARM_CONTAINS

The comma-separated names or descriptions of the indicators whose scorecards to return (sysparm_contains).

String

CamelServiceNowTags (producer)

Constant: SYSPARM_TAGS

The comma-separated sys_ids of the indicator groups whose scorecards to return (sysparm_tags).

String

CamelServiceNowPage (producer)

Constant: SYSPARM_PAGE

The number of the page of scorecards to return, with perPage scorecards per page (sysparm_page).

String

CamelServiceNowElementsFilter (producer)

Constant: SYSPARM_ELEMENTS_FILTER

The sys_id of the elements filter to apply to the returned scorecards (sysparm_elements_filter).

String

CamelServiceNowBreakdownRelation (producer)

Constant: SYSPARM_BREAKDOWN_RELATION

The sys_id of the breakdown relation to break down the returned scorecards by (sysparm_breakdown_relation).

String

CamelServiceNowDataSource (producer)

Constant: SYSPARM_DATA_SOURCE

The source of the configuration item data that the identify_reconcile subject of the misc resource sends (sysparm_data_source).

String

CamelServiceNowTopLevelOnly (producer)

Constant: SYSPARM_TOP_LEVEL_ONLY

Whether to return only the categories whose parent is the catalog. It replaces the topLevelOnly option.

Boolean

Message Body

The message body at each side of the ServiceNow component: Consumer is the body of the messages the consumer creates, Consumer reply the bodies a consumer that answers its caller can reply with, Producer input the bodies the producer can send or write, and Producer output the body after the producer.

Side Body Description

Producer input

map, pojo, text, bytes, stream, file or null

The record to create, modify or update must be an instance of the request model: a Map by default, an object of the class set with models or requestModels or the CamelServiceNowRequestModel header, or JSON text with a String model; another body fails. An attachment upload sends the body as a stream, with its content type in the CamelServiceNowContentType header. A retrieve or delete does not read the body: the action, table and sys_id are headers.

Producer output

map, list, pojo, text, stream or unchanged

The result of the call: a Map of the record, or a List of Maps for many, or objects of the response model class set with models or responseModels or the CamelServiceNowResponseModel header (the JSON text with a String model). The content of an attachment is an InputStream. A response with no content, such as a delete, leaves the body; the paging offsets and the other response fields are headers.

The bodies are the ones with the default options. A side that is not listed is not known, and tooling does not guess it. The carriers, the sides and the tools that use them are described in Message Body Types.

Table 1. 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 2. 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}

Examples:

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();

In YAML, the route sets the action and the limit as headers, and the resource and the table as endpoint options:

- route:
    from:
      uri: direct:servicenow
      steps:
        - setHeader:
            name: CamelServiceNowAction
            expression:
              constant:
                expression: retrieve
        - setHeader:
            name: CamelServiceNowLimit
            expression:
              constant:
                expression: "10"
        - to:
            uri: "servicenow:{{env:SERVICENOW_INSTANCE}}"
            parameters:
              resource: table
              table: incident
              userName: "{{env:SERVICENOW_USERNAME}}"
              password: "{{env:SERVICENOW_PASSWORD}}"
              oauthClientId: "{{env:SERVICENOW_OAUTH2_CLIENT_ID}}"
              oauthClientSecret: "{{env:SERVICENOW_OAUTH2_CLIENT_SECRET}}"
        - log:
            message: "${body}"