/servicenow:rest-integrationfrom ServiceNow
Make outbound REST calls from ServiceNow with sn_ws.RESTMessageV2 — basic/bearer/OAuth/API-key auth, error handling by status code, response parsing, sys_rest_message records, and retry with exponential backoff.
Ships in ServiceNow. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
ServiceNow provides RESTMessageV2 for outbound REST API calls and the REST API for inbound requests.
var request = new sn_ws.RESTMessageV2()
request.setEndpoint("https://api.example.com/users")
request.setHttpMethod("GET")
request.setRequestHeader("Accept", "application/json")
var response = request.execute()
var httpStatus = response.getStatusCode()
var body = response.getBody()
if (httpStatus == 200) {
var data = JSON.parse(body)
gs.info("Found " + data.length + " users")
}
var request = new sn_ws.RESTMessageV2()
request.setEndpoint("https://api.example.com/incidents")
request.setHttpMethod("POST")
request.setRequestHeader("Content-Type", "application/json")
request.setRequestHeader("Accept", "application/json")
var payload = {
title: "New Incident",
description: "Created from ServiceNow",
priority: "high",
}
request.setRequestBody(JSON.stringify(payload))
var response = request.execute()
Create a REST Message record for reusable integrations:
// Using predefined REST Message from sys_rest_message
var request = new sn_ws.RESTMessageV2("External API", "Create User")
// Set variable substitutions defined in the REST Message
request.setStringParameter("user_name", userName)
request.setStringParameter("email", email)
var response = request.execute()
var request = new sn_ws.RESTMessageV2()
request.setEndpoint("https://api.example.com/data")
request.setHttpMethod("GET")
request.setBasicAuth("username", "password")
var request = new sn_ws.RESTMessageV2()
request.setEndpoint("https://api.example.com/data")
request.setHttpMethod("GET")
request.setRequestHeader("Authorization", "Bearer " + token)
var request = new sn_ws.RESTMessageV2()
request.setEndpoint("https://api.example.com/data")
request.setHttpMethod("GET")
request.setAuthenticationProfile("oauth2", "My OAuth Profile")
var request = new sn_ws.RESTMessageV2()
request.setEndpoint("https://api.example.com/data")
request.setHttpMethod("GET")
request.setRequestHeader("X-API-Key", apiKey)
// Or as query parameter
request.setQueryParameter("api_key", apiKey)
try {
var request = new sn_ws.RESTMessageV2()
request.setEndpoint("https://api.example.com/data")
request.setHttpMethod("GET")
request.setHttpTimeout(10000) // 10 second timeout
var response = request.execute()
var httpStatus = response.getStatusCode()
if (httpStatus == 200) {
var body = response.getBody()
var data = JSON.parse(body)
// Process successful response
} else if (httpStatus == 401) {
gs.error("Authentication failed")
} else if (httpStatus == 404) {
gs.error("Resource not found")
} else if (httpStatus >= 500) {
gs.error("Server error: " + httpStatus)
} else {
gs.error("Unexpected status: " + httpStatus)
}
} catch (ex) {
gs.error("REST Exception: " + ex.message)
}
var body = response.getBody()
var data = JSON.parse(body)
// Access nested data
var userName = data.user.name
var items = data.items || []
var body = response.getBody()
var users = JSON.parse(body)
for (var i = 0; i < users.length; i++) {
var user = users[i]
gs.info("User: " + user.name + " (" + user.email + ")")
}
var contentType = response.getHeader("Content-Type")
var rateLimitRemaining = response.getHeader("X-RateLimit-Remaining")
// Create REST Message record
snow_create_rest_message({
name: "External API",
endpoint: "https://api.example.com",
authentication: "basic", // or "oauth2", "api_key"
methods: [
{
name: "Get Users",
http_method: "GET",
endpoint: "/users",
},
{
name: "Create User",
http_method: "POST",
endpoint: "/users",
content_type: "application/json",
},
],
})
// Test REST connection
snow_test_rest_connection({
endpoint: "https://api.example.com/health",
})
setHttpTimeout()gs.error() for debuggingfunction callApiWithRetry(endpoint, maxRetries) {
var retries = 0
var delay = 1000 // Start with 1 second
while (retries < maxRetries) {
try {
var request = new sn_ws.RESTMessageV2()
request.setEndpoint(endpoint)
request.setHttpMethod("GET")
var response = request.execute()
if (response.getStatusCode() == 200) {
return JSON.parse(response.getBody())
}
if (response.getStatusCode() >= 500) {
// Server error - retry
retries++
gs.sleep(delay)
delay = delay * 2 // Exponential backoff
continue
}
// Client error - don't retry
throw new Error("Client error: " + response.getStatusCode())
} catch (ex) {
retries++
if (retries >= maxRetries) {
throw ex
}
gs.sleep(delay)
delay = delay * 2
}
}
}
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub serac-labs/serac --plugin servicenow70 skills in this plugin
/acl-securityCreate and debug ServiceNow ACLs (record, field, REST, script-include). Covers role/condition/script patterns, which ACL names can apply to a table or field, field-level visibility, and impersonation testing for row- and field-level security./agent-workspaceBuild ServiceNow Agent Workspace configurations — workspaces, lists, forms, contextual side panels, Agent Assist similar-record finders, and workspace-specific UI actions on sys_aw_* tables./agile-developmentServiceNow Agile Development 2.0 — the rm_team → rm_sprint → rm_story → rm_epic model, the state and point values ServiceNow actually accepts, how a story is attached to a sprint, and the reporting tools (board, burndown, velocity, capacity, standup, retrospective).Other plugins' skills for the same job