← ServiceNow CAD: develop and deliver applications
07 / 8 · 40 MIN

Import and REST integration

Interpret identity, errors, and confirmation of the external outcome.

Concept and mechanism

An import should separate incoming data, transformation, and target. Use a synthetic sample containing updates, new records, and invalid values. Coalesce determines matching; with multiple fields, all must match. A mutable descriptive name is not a good stable key. Analyze duplicates and normalization rules before loading the full set. For REST integrations, RESTMessageV2 configures endpoint, method, authentication, and request. An empty object requires an explicit endpoint and method. When setRequestBody receives a script-built string, body variables are not automatically substituted from function-record parameters. Build and serialize the payload according to the contract without concatenating unvalidated input.

Guided application

In the response, getStatusCode represents HTTP; getErrorCode represents platform-specific codes. Do not classify internal code 1 as HTTP 1. Check transport failure, HTTP status, and business content, protecting parsing against invalid JSON. setHttpTimeout uses milliseconds and limits socket inactivity, not a hard total duration when data is streamed. An external creation request timing out may already have produced its effect. Before retrying, query by correlation and apply the idempotency contract actually supported by the service; do not assume an arbitrary header provides one. Logs should retain correlation and diagnostics without exposing credentials or confidential payloads. Test cases should also demonstrate error responses, timeout, and recovery.

IN PRACTICE

HTTP 202 confirms acceptance under the contract, not necessarily completion of the operation.

Common pitfalls

Internal error treated as HTTP; timeout treated as rollback; coalesce using mutable attributes.

Related topics: Needs, data, and design · Scope, modules, and dependencies · Forms and client/server logic

Take this idea with you

Confirm identity and outcome before repeating external effects.

Create account

Reference: RESTResponseV2 API · CAD blueprint January 2026