Przejdź do treści
Biblioteka skilli
DevOps i chmura · Integracja z narzędziem

servicenow-api

/servicenow-api

Konfiguruje dostęp do REST API ServiceNow: konta serwisowe, role, ACL i uwierzytelnianie, oraz pracuje z CMDB.

Licencja
MIT
Ostatnia zmiana repozytorium
26.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
63
Skrypty
2
Komentarze HTML
0
Adresy URL w SKILL.md
1
Przestarzałość

Brak sygnałów. Repozytorium zmienione 26.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co sprawdzić przed instalacją
  • 2 skrypty w paczce. Przejrzyj je przed instalacją, bo Claude może je uruchomić.

Skrypty: evals/nightly-csv-sync-to-cmdb-with-ire/place-files.sh, scripts/servicenow_api.py

Co robi i kiedy

Konfiguruje dostęp do REST API ServiceNow: konta serwisowe, role, ACL i uwierzytelnianie, oraz pracuje z CMDB.

Oryginalny opis (EN)

Work with ServiceNow through its REST APIs, with emphasis on setting up API access correctly (service accounts, roles, ACLs, basic/OAuth/API-key auth) and on CMDB data. Use it whenever a task mentions ServiceNow, service-now.com, a PDI or dev instance, the Table API, sysparm_query or encoded queries, the CMDB, configuration items (cmdb_ci classes), CI relationships (cmdb_rel_ci), Identification and Reconciliation (IRE), discovery sources, integration users, OAuth, REST API keys, roles like itil, cmdb_read or snc_platform_rest_api_access, rate limits, or automating, syncing, bulk-loading, audit

Jak działa

  1. Pick the entry point
  2. Core mechanics
  3. CMDB essentials
  4. Workflow for a typical task
  5. Scripts
  6. References
  7. Conventions when answering
Sekcje z nagłówków SKILL.md, w oryginale · 152 linii, 1 458 słów
Podgląd SKILL.md
---
name: servicenow-api
description: >-
  Work with ServiceNow through its REST APIs, with emphasis on setting up API access correctly
  (service accounts, roles, ACLs, basic/OAuth/API-key auth) and on CMDB data. Use it whenever a task
  mentions ServiceNow, service-now.com, a PDI or dev instance, the Table API, sysparm_query or
  encoded queries, the CMDB, configuration items (cmdb_ci classes), CI relationships (cmdb_rel_ci),
  Identification and Reconciliation (IRE), discovery sources, integration users, OAuth, REST API
  keys, roles like itil, cmdb_read or snc_platform_rest_api_access, rate limits, or automating,
  syncing, bulk-loading, auditing or cleaning anything in a ServiceNow instance, even if the user
  never says "API". Covers step-by-step admin setup, 401/403 troubleshooting, Table API CRUD with
  pagination and display values, Aggregate and Batch APIs, CMDB Instance and Meta APIs, IRE
  payloads, relationships, the CI class hierarchy, status fields and retire vs delete. Includes
  references, a docs snapshot, an OpenAPI spec and a Python client.
license: MIT
compatibility: Python 3.10+ for the bundled script (standard library only); curl examples otherwise.
metadata:
  author: jj1985
  version: "1.0.0"
  platform: ServiceNow (Washington DC, Xanadu, Yokohama, Zurich)
---

# ServiceNow API

ServiceNow exposes every table through one REST surface (`/api/now/table/{table}`), plus purpose
APIs for aggregates, batches, attachments, imports and the CMDB. Access is governed by the same
roles and ACLs as the UI, which is where most integration failures come from, so this skill leads
with access setup and then the CMDB-specific mechanics.

## Pick the entry point

| Task | Use | Read |
|---|---|---|
| Set up API access: service account, roles, basic / OAuth / API key, rate limits | admin checklist and curl smoke tests | `references/auth-and-access.md` §9, then §1-4 |
| Diagnose 401 / 403 / 404 / 429 | ACL and policy troubleshooting table | `references/auth-and-access.md` §10, `references/gotchas.md` |
| Read, filter, page, create, update, delete records on any table | Table API | `references/table-api.md` |
| Counts and group-bys | Aggregate API `/api/now/stats/{table}` | `references/table-api.md` §7 |
| Several calls in one round trip | Batch API `/api/now/v1/batch` | `references/table-api.md` §8 |
| Files on records / bulk rows through transforms | Attachment API / Import Set API | `references/table-api.md` §9-10 |
| Find CIs, read a CI with its relationships | Table API on the class table; CMDB Instance API | `references/cmdb.md` §1-4 |
| Create or update CIs from an external source without duplicates | IRE `POST /api/now/identifyreconcile` | `references/cmdb.md` §6 |
| Relationships, class hierarchy, status values, which fields identify a class | `cmdb_rel_ci`, Meta API | `references/cmdb.md` §2-3, §5, §7 |
| Decommission CIs | retire, then Data Manager; hard delete last | `references/cmdb.md` §8 |
| Exact request/response shapes | OpenAPI spec | `references/servicenow.openapi.yaml` |
| Official wording for one endpoint's field table | docs snapshot (large; open one page, not all) | `references/source-docs/INDEX.md` |

## Core mechanics

**Base URL** `https://<instance>.service-now.com`. Unversioned paths (`/api/now/table/...`) track the
latest version; `/api/now/v2/table/...` pins one. Pin versions in production integrations.

**Authentication.** Every `/api/now/*` call needs credentials; there is no anonymous access.
- Basic: `Authorization: Basic base64(user:password)`; only for *Web service access only* accounts
  (SSO/MFA users get 401; the Basic Auth Restriction phases it out for interactive accounts).
- OAuth: register a client under *System OAuth > Application Registry* (Zurich: Machine Identity
  Console), `POST /oauth_token.do` **form-encoded** with `grant_type=password|client_credentials|refresh_token`,
  then `Authorization: Bearer <token>`. Access tokens last 30 min, refresh tokens 100 days.
  Client credentials (Washington DC+) needs `glide.oauth.inbound.client.credential.grant_type.enabled=true`
  and an *OAuth Application User* on the registry record.
- API key (Washington DC+): header `x-sn-apikey: <token>` after creating an inbound auth profile, a
  REST API Key bound to a user, and a REST API Access Policy for the API.
Recommend a dedicated machine user per integration with a custom role and explicit ACLs rather
than `admin` or `itil` wholesale; `cmdb_read` for read-only CMDB, `itil` to write CIs, `asset` for
assets, `snc_platform_rest_api_access` only when the platform REST ACLs are active.

**Headers.** `Accept: application/json`; `Content-Type: application/json` on writes;
`X-no-response-body: true` to skip the echo.

**Response envelope.** `{"result": ...}` on success; `{"error": {"message", "detail"}, "status": "failure"}`
on failure (the useful text is in `detail`). References come back as `{"link","value"}` objects.

**Encoded queries** (`sysparm_query`): `^` AND, `^OR`, `=`, `!=`, `LIKE`, `STARTSWITH`, `IN`,
`ISEMPTY`, `>=`, `BETWEEN`, `ORDERBY`, dot-walk `location.name=London`, javascript date helpers.
Choice fields use stored values, not labels. Copy a filter from any list view with right-click >
*Copy query*. Invalid terms are **ignored**, not rejected.

**Pagination.** `sysparm_limit` (default 10,000) + `sysparm_offset`, or follow the `Link: rel="next"`
header; `X-Total-Count` has the total. Always add `^ORDERBYsys_id`; advance by the requested limit
because ACLs can shorten a page. Use `sysparm_fields` and `sysparm_exclude_reference_link=true`.

**Writes.** `POST` creates one record (201), `PATCH` updates the supplied fields (200; `PUT` behaves
the same), `DELETE` is a hard delete (204). `sysparm_input_display_value=true` lets you send display
values (reference names, choice labels, local-time dates).

## CMDB essentials

- Classes are a table-per-class tree under `cmdb_ci`; `sys_class_name` names the concrete class.
  Query the most specific class you can (`cmdb_ci_linux_server`, `cmdb_ci_win_server`,
  `cmdb_ci_vmware_instance`, `cmdb_ci_app_server_tomcat`, `cmdb_ci_service_auto`...). `cmdb_ci`
  returns everything with base fields only.
- **Create/update from integrations through IRE**, never plain Table API inserts: identification
  rules (serial number, name, network adapter...) find the existing CI, reconciliation rules decide
  which source may overwrite which attribute. `POST /api/now/identifyreconcile?sysparm_data_source=<source>`
  with `items[{className, values, lookup, sys_object_source_info}]` and `relations[{parent_id, child_id, type}]`;
  `/query` dry-runs, `/enhanced` adds partial payloads and a summary. The data source must exist in
  the `cmdb_ci.discovery_source` choice list.
- `GET /api/now/cmdb/instance/{class}/{sys_id}` returns attributes plus inbound/outbound relations;
  `GET /api/now/cmdb/meta/{class}` tells you the identifiers and mandatory fields.
- Relationships are `cmdb_rel_ci` rows (`parent`, `child`, `type` -> `cmdb_rel_type`). Direction is
  *parent* `parent_descriptor` *child*: an application `Runs on::Runs` a server, an application
  service `Depends on::Used by` a server. Resolve type sys_ids and target sys_ids by query, never by
  hard-coding.
- Status: `install_status` (7 = Retired) and `operational_status` (6 = Retired, 1 = Operational);
  verify other values via `sys_choice`. Retire before you delete; hard delete cascades
  relationships and clears references on tasks and assets.

## Workflow for a typical task

1. **Confirm scope**: instance URL, release if known, credential type, which tables/classes, read or
   write. Read `SN_*` environment variables; never echo secrets.
2. **Check access before building**: `whoami` (user flags, roles) and `probe <tables>` (per-table
   read result and `ws_access`) in `scripts/servicenow_api.py`; or one `GET ...?sysparm_limit=1`
   per table. Fix roles/ACLs first; nothing else works otherwise.
3. **Resolve ids by query** (users, groups, locations, models, application services, relationship
   types) instead of hard-coding sys_ids.
4. **Read before write**: GET the record, change fields, PATCH. For CMDB feeds build the IRE payload,
   dry-run with `/identifyreconcile/query`, inspect `operation` and `errors` per item, then commit.
5. **Batch and page sensibly**: pages of 1,000-5,000, `ORDERBYsys_id`, the Batch API or Import Set
   `insertMultiple` for many writes, chunks of a few hundred items for IRE. Respect 429
   (`Retry-After`) and the 60 s transaction quota.
6. **Verify** by re-reading (Table API GET, Instance API for relations, Aggregate API for counts) and
   point the user at *System Logs > Transactions* for the audit trail.
7. **Destructive operations**: count first, retire instead of delete when the goal is
   decommissioning, mention `sys_audit_delete` / Deleted Records for recovery, and recommend a
   sub-production run.

## Scripts

`scripts/servicenow_api.py` (standard library only): auth negotiation (basic, OAuth password /
client credentials / refresh, API key, bearer), Table API get/query/iterate/create/update/delete,
Aggregate, Batch, Attachment, Import Set, CMDB Instance (get/list/create/update/relations), Meta,
IRE (commit / query / enhanced / queryEnhanced), relationship helpers, retire, CSV-to-IRE bulk
load, `whoami`, `probe`, `choices`, `rel-types`, `sources`. `python scripts/servicenow_api.py --help`.
Configure with `SN_INSTANCE` plus `SN_USERNAME`/`SN_PASSWORD`, `SN_API_KEY`, or
`SN_CLIENT_ID`/`SN_CLIENT_SECRET` (+ `SN_OAUTH_GRANT=client_credentials`); `SN_CA_BUNDLE` for a
private CA. Hard deletes require `--yes`.

## References

- `references/auth-and-access.md`: auth methods compared, OAuth/API-key/basic setup, roles, ACLs,
  table flags, scoped apps, REST API Explorer, rate limits, quotas, logs, IP control, PDIs, the
  zero-to-first-call checklist and the 401/403 troubleshooting table.
- `references/table-api.md`: Table API endpoints, parameters, pagination, encoded-query cheat sheet,
  response/error shapes, headers, Aggregate, Batch, Attachment, Import Set, worked curl examples.
- `references/cmdb.md`: API selection, class hierarchy, key fields and status values, Instance and
  Meta APIs, IRE payload/response, relationships, retire vs delete, CMDB roles, data quality, bulk
  patterns, worked examples.
- `references/gotchas.md`: failure causes and fixes, grouped by auth, Table API, CMDB.
- `references/servicenow.openapi.yaml`: OpenAPI 3.1 for the Table, Aggregate, Batch, Attachment,
  Import Set, CMDB Instance, CMDB Meta, IRE APIs and the OAuth token endpoint.
- `references/source-docs/`: snapshot of the official API reference and product docs pages
  (see `INDEX.md`). The pages are large (the IRE reference alone is 170 KB): read the summaries
  above first and open a snapshot only to confirm a specific field, parameter or example. Check
  the live docs for the user's release when a detail matters.

## Conventions when answering

- Show `METHOD /path` with query parameters URL-decoded for readability and a JSON body; mention the
  auth header once. Use placeholders `<instance>`, `<sys_id>` and say how to find them.
- Name the role or ACL a step needs and the UI navigation path (`All > System OAuth > Application
  Registry`) when the user has to click something.
- Prefer IRE for CMDB writes, PATCH for updates, retire over delete, and explicit `ORDERBY` on lists;
  say why in one clause when you deviate.
- Flag release gating (Washington DC+ for API keys and client credentials; Zurich for the Machine
  Identity Console) and anything the docs leave unconfirmed, so the user verifies on their instance.
- Make deliverables self-contained. A runbook, script or README you write for the user must not
  tell them to open `references/...` or run `scripts/servicenow_api.py` unless they have this
  skill installed; inline the facts and the curl/Python they need. Mention the bundled client only
  as an optional shortcut, by its path in the repository.
- Warn before any ACL change on a CMDB subclass that it cuts off the parent-table rules (see
  `references/auth-and-access.md` §7), and before any hard delete that it cascades relationships.
- For one-off questions answer from the references directly instead of walking the whole workflow.
Pliki w paczce (63)
  • SKILL.md 12 KB
  • evals/decommission-legacy-servers-safely/case.yaml 1 KB
  • evals/decommission-legacy-servers-safely/prompt.md 1 KB
  • evals/decommission-legacy-servers-safely/graders/01-find-query-startswith.md 1 KB
  • evals/decommission-legacy-servers-safely/graders/02-count-and-stable-paging.md 1 KB
  • evals/decommission-legacy-servers-safely/graders/03-relationships-retrieved.md 1 KB
  • evals/decommission-legacy-servers-safely/graders/04-retire-before-delete.md 1 KB
  • evals/decommission-legacy-servers-safely/graders/05-delete-cascade-and-recovery.md 1 KB
  • evals/decommission-legacy-servers-safely/graders/06-itil-delete-acl-warning.md 1 KB
  • evals/decommission-legacy-servers-safely/graders/07-open-tasks-and-subprod.md 1 KB
  • evals/decommission-legacy-servers-safely/graders/08-correct-paths-and-methods.md 1 KB
  • evals/nightly-csv-sync-to-cmdb-with-ire/case.yaml 1 KB
  • evals/nightly-csv-sync-to-cmdb-with-ire/place-files.sh 1 KB
  • evals/nightly-csv-sync-to-cmdb-with-ire/prompt.md 1 KB
  • evals/nightly-csv-sync-to-cmdb-with-ire/files/servers.csv 1 KB
  • evals/nightly-csv-sync-to-cmdb-with-ire/graders/01-uses-ire-not-table-post.md 1 KB
  • evals/nightly-csv-sync-to-cmdb-with-ire/graders/02-data-source-and-class.md 1 KB
  • evals/nightly-csv-sync-to-cmdb-with-ire/graders/03-serial-number-identifier.md 1 KB
  • evals/nightly-csv-sync-to-cmdb-with-ire/graders/04-resolves-app-service-by-query.md 1 KB
  • evals/nightly-csv-sync-to-cmdb-with-ire/graders/05-valid-relationship-type-and-direction.md 1 KB
  • evals/nightly-csv-sync-to-cmdb-with-ire/graders/06-credentials-from-env.md 1 KB
  • evals/nightly-csv-sync-to-cmdb-with-ire/graders/07-per-item-result-handling.md 1 KB
  • evals/nightly-csv-sync-to-cmdb-with-ire/graders/08-readme-prerequisites.md 1 KB
  • evals/nightly-csv-sync-to-cmdb-with-ire/graders/09-script-compiles.md 1 KB
  • evals/setup-oauth-cmdb-integration-user/case.yaml 1 KB
  • evals/setup-oauth-cmdb-integration-user/prompt.md 1 KB
  • evals/setup-oauth-cmdb-integration-user/graders/01-service-user-web-service-only.md 1 KB
  • evals/setup-oauth-cmdb-integration-user/graders/02-least-privilege-no-admin.md 1 KB
  • evals/setup-oauth-cmdb-integration-user/graders/03-application-registry-path.md 1 KB
  • evals/setup-oauth-cmdb-integration-user/graders/04-client-credentials-prerequisites.md 1 KB
  • evals/setup-oauth-cmdb-integration-user/graders/05-token-curl-form-encoded.md 1 KB
  • evals/setup-oauth-cmdb-integration-user/graders/06-verify-curl-bearer-server.md 1 KB
  • evals/setup-oauth-cmdb-integration-user/graders/07-token-lifetimes-or-refresh.md 1 KB
  • evals/setup-oauth-cmdb-integration-user/graders/08-troubleshoot-401-vs-403.md 1 KB
  • references/auth-and-access.md 23 KB
  • references/cmdb.md 24 KB
  • references/gotchas.md 7 KB
  • references/servicenow.openapi.yaml 149 KB
  • references/table-api.md 12 KB
  • references/source-docs/INDEX.md 6 KB
  • references/source-docs/api__aggregate-api.md 9 KB
  • references/source-docs/api__attachment-api.md 29 KB
  • references/source-docs/api__batch-api.md 14 KB
  • references/source-docs/api__cmdb-instance-api.md 84 KB
  • references/source-docs/api__cmdb-meta-api.md 9 KB
  • references/source-docs/api__identification-reconciliation-api.md 172 KB
  • references/source-docs/api__import-set-api.md 18 KB
  • references/source-docs/api__table-api.md 57 KB
  • references/source-docs/docs__base-system-roles.md 70 KB
  • references/source-docs/docs__basic-authentication.md 3 KB
  • references/source-docs/docs__cmdb-classifications-and-class-dependency.md 3 KB
  • references/source-docs/docs__cmdb-identification-reconciliation-engine.md 20 KB
  • references/source-docs/docs__cmdb-identification-rules.md 9 KB
  • references/source-docs/docs__cmdb-overview-and-roles.md 9 KB
  • references/source-docs/docs__cmdb-reconciliation-rules.md 8 KB
  • references/source-docs/docs__cmdb-tables-descriptions.md 58 KB
  • references/source-docs/docs__inbound-rest-api-rate-limiting.md 4 KB
  • references/source-docs/docs__non-interactive-sessions-web-service-access-only.md 5 KB
  • references/source-docs/docs__oauth-create-endpoint-for-external-clients.md 5 KB
  • references/source-docs/docs__rest-api-explorer.md 1 KB
  • references/source-docs/docs__rest-api-key-token-based-authentication.md 6 KB
  • references/source-docs/rest-api-index.md 33 KB
  • scripts/servicenow_api.py 43 KB

Wersje

W bazie nie ma innych skilli o nazwie servicenow-api.

Migawka bazy z 13.11.2026 · wersja paczki 95501365b262 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 1 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100servicenow-cmdb
    Audytuje bazę CMDB w ServiceNow jako model danych: hierarchię klas CI, relacje, duplikaty, osierocone rekordy i zgodność z CSDM 5.
  • 100sn
    Obsługuje ServiceNow przez CLI sn: odczyt i zmiany incydentów, zmian, CMDB, katalogu i załączników.
  • 100servicenow-expert
    Wspiera rozwój na platformie ServiceNow: skrypty, przepływy pracy, Service Portal, CMDB, moduły ITSM i integracje, w tym API skryptowe i zapytania GlideRecord.
  • 100servicenow-itsm-integration
    Łączy ServiceNow z narzędziami dyżurowymi, np. PagerDuty i Opsgenie, synchronizuje incydenty przez Table API i obsługuje zatwierdzanie zmian.
  • 100sn
    Obsługuje zgłoszenia ServiceNow przez CLI sn: czyta i aktualizuje incydenty, zmiany, problemy, CI i załączniki.
  • 100servicenow-itsm-configuration-validation
    Sprawdza konfigurację przepływów incydentów, zmian i problemów w ServiceNow: mapowanie CI do zespołów, zatwierdzenia i martwe ścieżki przejść.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.