Working with External Data

33 questions from the Working with External Data domain of the ServiceNow Certified Application Developer (CAD) exam, each with its answer and an explanation. Read them through as revision, then sit the full practice exam to test yourself on them under multiple-choice conditions.

  1. 1.When a ServiceNow instance requests information from a web service, ServiceNow is the web service:

    Answer

    • Consumer

    The system that sends the request and uses the response is the web service consumer, for example when a REST message calls an external API. The system that exposes the service and answers the request is the provider.

  2. 2.One of the uses of the ServiceNow REST API Explorer is:

    Answer

    • Create sample code for sending REST requests to ServiceNow

    The REST API Explorer lets you build and send requests to the instance's own REST APIs, such as the Table API, and generates sample code for them in formats such as cURL, JavaScript and Python. It doesn't connect to public providers, teach REST or convert SOAP functions.

  3. 3.When configuring a REST Message, the Endpoint is:

    Answer

    • The URI of the data to be accessed, queried, or modified

    The endpoint is the URI the request is sent to, which identifies the resource being read, created or changed. The format of the returned data is set with headers such as Accept, and what the provider sends back is the response.

  4. 4.Which platform feature can be used to determine the relationships between fields in an Import Set table and fields in an existing ServiceNow table?

    Answer

    • Transform Map

    A transform map defines which import set table field is written to which field on the target table, and can run scripts during the transform. A data source only describes where the imported data comes from.

  5. 5.Which API provides methods to translate text into multiple languages in real time?

    Answer

    • DynamicTranslation

    The DynamicTranslation API translates text on demand into one or more languages through a configured translation service. The other options are not translation APIs.

  6. 6.Which utility is used to determine if field names in an Import Set match the field names on the target table when importing data into ServiceNow?

    Answer

    • Auto Map Matching Fields

    Auto Map Matching Fields, a related link on the transform map, creates field maps for every import set field whose name matches a field on the target table. Mapping Assist is for mapping fields by hand, and the transform map is the record that holds the mappings.

  7. 7.In a transform map, only one field can be used for coalesce. True or False?

    Answer

    • FALSE

    Several fields can be marked as coalesce fields. They are combined, so an existing record is updated only when all of them match; otherwise a new record is inserted.

  8. 8.Which of the following is true for a Scripted REST API? (a) It is faster than the standard Table REST API. (b) It can be used to combine data from multiple tables. (c) It is used to limit access to system tables. (d) It is useful when a REST operation involves complex operations.

    Answer

    • b and d

    A scripted REST API defines custom endpoints with scripted logic, so it can combine data from several tables and handle operations more complex than simple create, read, update and delete. It isn't inherently faster than the Table API, and access to tables is limited with access controls.

  9. 9.When accessing a table using the REST API, is authentication required for every request sent to the server?

    Answer

    • Yes

    REST requests are stateless, so each request has to carry its own credentials, such as basic authentication or an OAuth token, and the instance authenticates every request separately.

  10. 10.Which of the following methods is NOT available in the ServiceNow REST API?

    Answer

    • COPY

    ServiceNow REST APIs use the standard HTTP methods GET, POST, PUT, PATCH and DELETE. COPY is not one of them.

  11. 11.Can token-based or OAuth authentication be used in ServiceNow when consuming a REST API?

    Answer

    • Yes

    REST messages and IntegrationHub connections can authenticate to external APIs with OAuth profiles and tokens, as well as with basic authentication, so a user name and password don't have to be sent with every call.

  12. 12.Can you select the format (Multipart, Binary, Text) of a REST message when writing a REST step in Flow Designer?

    Answer

    • Yes

    The REST step lets you choose how the request body is sent, such as text, binary or multipart, to match what the external service expects.

  13. 13.Which APIs require the Transformation Service plugin to be activated?

    Answers

    • Transformer()
    • TransformerRuleList()
    • TransformerDefinition()

    Transformer(), TransformerDefinition() and TransformerRuleList() are part of the Transformation Service plugin, which defines and runs data transformations from scripts. GlideImportSetTransformer() and GlideTransformLog() work without that plugin.

  14. 14.What is the purpose of IntegrationHub in ServiceNow?

    Answer

    • It enables execution of third-party APIs as part of a flow when a specific event occurs in ServiceNow

    IntegrationHub lets flows call third-party systems through spokes and actions, such as the REST step, when something happens in ServiceNow. It isn't a single workflow activity or an import tool.

  15. 15.For what purpose can the getContentBase64() method be used in a ServiceNow scoped application?

    Answer

    • To send attachments to third-party systems over REST API

    getContentBase64() returns an attachment's content as a Base64-encoded string, which can be placed in a REST request body to send the file to another system. Saving attachments is done with other GlideSysAttachment methods, such as write().

  16. 16.Which port needs to be open when doing an LDAP integration in ServiceNow?

    Answer

    • Port 389, but in that case you should explicitly verify that encryption is being done.

    LDAP uses port 389 by default. Traffic on that port isn't encrypted on its own, so you should make sure the connection is protected, for example by using LDAPS on port 636.

  17. 17.What is the Payload field in the ECC Queue table?

    Answer

    • The payload column holds the data itself.

    An ECC Queue record represents one message between the instance and a MID Server or another system, and its Payload field holds the content of that message. Details such as the agent and topic are kept in other fields.

  18. 18.Which of the following is NOT true regarding LDAP integration into ServiceNow?

    Answer

    • ServiceNow integration can only bring data into the system from active OU definitions.

    Statement c is not true: which data an LDAP integration brings in depends on how its OU definitions, filters, attributes and transform maps are configured, not only on whether OU definitions are active.

  19. 19.Is anything wrong with this REST script: it calls setEndpoint, setHttpMethod, setBasicAuth, setRequestHeader and setRequestBody, and then gs.log(response.getBody())?

    Answer

    • Missing the execute method before the last line. Need to add: var response = request.execute();

    Setting up the RESTMessageV2 request doesn't send anything. The script has to call var response = request.execute(); to send the request and get a response object before it can read response.getBody().

  20. 20.Is it true that you can use the RESTMessageV2 API only in scoped applications?

    Answer

    • No. You can use this API in scoped applications, or within the global scope.

    RESTMessageV2 sends outbound REST requests from server scripts, and it can be used in both scoped applications and the global scope.

  21. 21.Which of the following are NOT types of authentication used by REST APIs?

    Answers

    • JDBC
    • CIM

    REST requests can be authenticated with basic authentication, OAuth 2.0 or mutual authentication using protocol profiles. JDBC is a way of connecting to databases, and CIM is not an authentication method.

  22. 22.How can a developer extract data from the response body after calling a REST web service?

    Answers

    • Use the JSON API to convert JSON formatted responses to a JavaScript object
    • Use the XMLDocument2 API to extract data from XML formatted responses.

    JSON responses are converted to JavaScript objects with the JSON API, for example JSON.parse(), and data in XML responses is read with the XMLDocument2 API. There is no Convert Response Body wizard or button, and XMLDocument2 is an API rather than a script include.

  23. 23.Which one of the following describes how to select the Credential record to use for a REST step?

    Answer

    • Select the Credential on the Connection & Credential alias

    A REST step uses a Connection & Credential alias, and the credential set up for that alias is the one used. That keeps credentials out of the flow itself and lets them differ between instances. The step never tries credentials one by one.

  24. 24.Which of the following is NOT an IntegrationHub subscription level?

    Answer

    • Basic

    IntegrationHub is available as Starter, Standard, Professional and Enterprise subscriptions, each adding more spokes and features. Basic is not one of them.

  25. 25.Which of the following features and spokes use IntegrationHub?

    Answers

    • PowerShell step
    • Slack spoke
    • XML Parser

    The PowerShell step, the Slack spoke and the XML Parser step are IntegrationHub features that need an IntegrationHub subscription. Make a decision flow logic is a core Flow Designer feature, and the Customer Service spoke comes with the Customer Service Management application.

  26. 26.Which one of the following is NOT an available HTTP method?

    Answer

    • UPDATE

    GET, POST, PUT and DELETE are standard HTTP methods for reading, creating, replacing and deleting resources. There is no UPDATE method; records are updated with PUT or PATCH.

  27. 27.Query parameters are name/value pairs appended to the endpoint value at runtime. For example, a query parameter with the name last and the value 2 is appended to the earnings endpoint as https://cloud.iexapis.com/stable/stock/${symbol}/earnings?last=2. True or False?

    Answer

    • TRUE

    Query parameters are added after a question mark at the end of the endpoint as name=value pairs, joined with & when there are several, so a parameter named last with the value 2 becomes ?last=2.

  28. 28.Inline connections should only be used in REST steps for testing. True or False?

    Answer

    • TRUE

    An inline connection stores the connection details inside the action, which is convenient while testing. For real use, a Connection & Credential alias lets each instance supply its own connection and credentials without editing the action.

  29. 29.Are REST Message records required to interact with external REST web services?

    Answer

    • FALSE

    No. A script can create a RESTMessageV2 object and set its endpoint, method, headers and body directly, without a REST Message record. REST Message records make the configuration reusable and easier to maintain.

  30. 30.Which of the following is NOT information used to configure a REST Message record?

    Answer

    • Name

    A REST Message's endpoint, authentication, HTTP methods and HTTP headers define the request that is sent. The name only identifies the record, so it isn't part of configuring the request.

  31. 31.Which of the following are authentication methods supported in a REST Message record?

    Answers

    • Basic
    • No authentication
    • OAuth 2.0

    A REST Message can use no authentication, basic authentication or OAuth 2.0. Username and Password isn't a separate option, because user names and passwords are covered by basic authentication, and query parameters pass data rather than authenticate.

  32. 32.Which of the following are options for how the response is formatted?

    Answers

    • application/json
    • application/xml
    • text/xml

    Responses can be returned as application/json, application/xml or text/xml. text/csv isn't one of the offered formats, and test/json isn't a valid media type.

  33. 33.Which of the following best describe ways to make a REST step dynamic?

    Answers

    • Use a data pill in the Resource Path for any variable information described in the external API's documentation
    • Use a data pill in the Query Parameter value for any query parameters described in the external API's documentation

    Data pills can be placed in the resource path for values that change, such as an ID in the URL, and in query parameter values. Choosing POST doesn't prompt anyone for values, and building the endpoint in a script isn't how a REST step is made dynamic.

Other CAD domains