REST API & Table API
ServiceNow's Table API is the most commonly used integration mechanism for reading and writing records. Understanding its URL structure, query parameters, and how ACLs apply to API responses is critical for both the exam and real-world integrations.
Table API Overview
The Table API is a RESTful API that exposes every table in ServiceNow as an HTTP endpoint. Any table you can navigate to in the UI has a corresponding API URL. The API supports all four standard HTTP verbs:
| HTTP Method | Operation | Use Case |
|---|---|---|
| GET | Read records | Query CIs, retrieve incident details |
| POST | Create a new record | Create a new incident or CI from external system |
| PUT | Replace a record (full update) | Overwrite all fields on an existing record |
| PATCH | Partial update | Update specific fields without affecting others |
| DELETE | Delete a record | Remove a CI or record by sys_id |
URL Structure
For example, to get all active P1 incidents with specific fields:
Key Query Parameters
These parameters control what data the Table API returns and how it's formatted:
| Parameter | Purpose | Example |
|---|---|---|
| sysparm_query | Encoded query filter (same syntax as list view filters) | active=true^priority=1 |
| sysparm_fields | Comma-separated list of fields to return (reduces payload) | number,state,assigned_to |
| sysparm_limit | Maximum number of records to return | 50 (default: 10,000) |
| sysparm_offset | Record offset for pagination (skip first N records) | 100 (skip first 100) |
| sysparm_display_value | Return display values instead of raw values (true/false/all) | true = labels; false = codes |
| sysparm_exclude_reference_link | Remove reference link objects from response | true (smaller payload) |
sysparm_display_value=true returns only the label.
sysparm_display_value=false returns only the sys_id.
sysparm_display_value=all returns both. Choice fields behave similarly:
false gives the stored value (e.g., "1"), true gives the label (e.g., "P1 - Critical").
Authentication
The Table API supports several authentication methods. The exam tests when to use each:
| Method | How It Works | Best For |
|---|---|---|
| Basic Auth | Username:Password in Authorization header (Base64 encoded) | Quick testing only — never use in production |
| OAuth 2.0 | Request access token, include in Authorization: Bearer header. Token expires. | External applications integrating with ServiceNow |
| API Keys (Application Registry) | Generate a client ID/secret pair for a specific application | Server-to-server integrations |
| Mutual TLS | Certificate-based client authentication | High-security environments |
Table API vs. CMDB API
For CMDB data specifically, there is an important distinction between using the generic Table API and the dedicated CMDB API:
- Table API (generic) — POST to
/api/now/table/cmdb_ci_servercreates a CI record directly, bypassing IRE. No duplicate checking, no reconciliation rules. Quick but dangerous for CMDB integrity. - CMDB Identification and Reconciliation API —
/api/now/cmdb/instance— routes through IRE. Runs identification (match or create), then reconciliation (apply authoritative values). The correct method for CI creation/updates.
REST API for CMDB — Common Patterns
- Query CIs by class: GET
/api/now/table/cmdb_ci?sysparm_query=sys_class_name=cmdb_ci_server^operational_status=1 - Get a specific CI by sys_id: GET
/api/now/table/cmdb_ci_server/{sys_id} - Get CI relationships: GET
/api/now/table/cmdb_rel_ci?sysparm_query=parent={sys_id} - Update a CI field: PATCH
/api/now/table/cmdb_ci_server/{sys_id}with body{"managed_by": "{group_sys_id}"}
sysparm_fields to return
only the fields you need. This reduces response payload size significantly and speeds up
integration processing.
Common Exam Traps — REST API & Table API
- Table API URL:
/api/now/table/{tableName}— supports GET/POST/PUT/PATCH/DELETE - GET returns records; POST creates; PATCH updates specific fields; PUT replaces full record
- ACLs apply to API calls — calling user's access determines what data is returned/writable
- Fields user can't read = absent from response (no error); fields user can't write = silently ignored
- Never POST CIs directly via Table API — bypasses IRE; use CMDB Identification API or SGC
sysparm_display_value=truereturns labels;falsereturns raw values/sys_ids- Basic Auth = testing only; OAuth 2.0 = production external integrations
Practice Questions
4 questions · Select an answer to see the explanation immediately.
A developer uses the Table API to POST a new record directly to cmdb_ci_server to create a server CI from an automated deployment pipeline. What problem does this create?
B is correct. Direct Table API writes to CMDB tables bypass the IRE pipeline entirely. IRE (Identity and Reconciliation Engine) handles deduplication via Identification Rules and field authority via Reconciliation Rules. When you POST directly to cmdb_ci_server, no Identification Rules run — if a CI for that server already exists, a second (duplicate) CI is created. No Reconciliation Rules run — last-write wins regardless of source authority. The correct approach for programmatic CI creation is the CMDB Identification API (/api/now/cmdb/instance) or a Service Graph Connector, which routes data through IRE.