What type of API does ServiceNow provide?
ServiceNow offers multiple types of APIs, including REST, SOAP, and GraphQL. Here's a breakdown of the API types supported by ServiceNow:
REST API
ServiceNow primarily uses REST (Representational State Transfer) APIs. REST APIs are widely adopted due to their simplicity, scalability, and performance. They use standard HTTP methods like GET, POST, PUT, and DELETE to interact with resources.
Key points:
- REST APIs are the most commonly used and recommended API type for ServiceNow integrations.
- They are easy to implement and consume, making them popular among developers.
- REST APIs use JSON or XML for data exchange, with JSON being the more common format.
SOAP API
ServiceNow also supports SOAP (Simple Object Access Protocol) APIs. While less common than REST, SOAP APIs are still used in some enterprise environments.
Key points:
- SOAP APIs use XML for data exchange and are more structured than REST.
- They are typically used in legacy systems or when complex transactions and strict security are required.
- SOAP APIs can be more challenging to implement and consume compared to REST.
GraphQL API
ServiceNow has introduced support for GraphQL APIs. GraphQL is a more recent API technology that allows clients to request specific data they need.
Key points:
- GraphQL provides more flexibility in data retrieval, allowing clients to define the structure of the response.
- It can be more efficient than REST for complex queries, as it reduces over-fetching and under-fetching of data.
- GraphQL is gaining popularity but is not as widely adopted as REST in the ServiceNow ecosystem.
Best Practices
When working with ServiceNow APIs:
- Use REST APIs for most integrations due to their simplicity and wide support.
- Consider SOAP APIs only if required by specific enterprise requirements or legacy systems.
- Explore GraphQL for complex data retrieval scenarios where flexibility is crucial.
- Always follow ServiceNow's API documentation and best practices for optimal performance and security.
Does the ServiceNow API have webhooks?
ServiceNow does support webhooks, but they are not part of the core API. Instead, webhooks are implemented through outbound REST messages.
To set up a webhook in ServiceNow, you would typically:
- Create an outbound REST message.
- Set up a business rule to trigger the outbound REST message when certain conditions are met.
You can subscribe to various events in ServiceNow to trigger webhooks, such as:
- When a record is created, updated, or deleted.
- When a comment or work note is added to a ticket.
The webhook can send data in JSON format to an external system or endpoint.
To implement a webhook for sending comments to an external system:
- Create a business rule that triggers after a comment is added.
- In the business rule, call an outbound REST message to send the comment data to the external system.
It's important to consider bi-directional communication. If the external system (e.g., SOAR) creates comments, you may need to implement logic to prevent those comments from being sent back to the external system, creating an infinite loop.
The exact implementation details are not provided in the search results, but it's recommended to review the ServiceNow documentation and REST learning materials available on the developer portal for more specific guidance.
Rate Limits and other limitations
Here are the key points about API rate limits for the ServiceNow API:
Default Rate Limits
- There is no default rate limit if no specific limit is set up for an API [5].
- When no rate limit is configured, the API responses do not include any X-RateLimit headers [5].
Configuring Rate Limits
- Rate limits can be configured for specific APIs, users, roles, or all users [5].
- Limits are set as a number of requests allowed within a time period (e.g. 110 requests per hour) [5].
- Rate limits are applied per user, not aggregated across all users with a role [5].
How Rate Limits Work
- Each node maintains a rate limit count per user [5].
- The count is committed to the database every 30 seconds [5].
- This means a new rate limit rule may take up to 30 seconds to take effect [5].
Best Practices
- Configure appropriate rate limits to prevent performance issues from excessive API usage [5].
- Use role-based limits to control access for different user groups [5].
- Monitor API usage and adjust limits as needed [5].
Additional Notes
- The Table API has a default limit of 10,000 records per request (sysparm_limit parameter) [4].
- There may be an overall limit around 40,000 records for Table API requests, but this needs confirmation [4].
- For more detailed information on limits, customers can request additional documentation from ServiceNow [5].
In summary, ServiceNow allows flexible configuration of API rate limits, but does not impose strict default limits. Proper limit configuration is important to ensure system performance and stability.
Latest API Version
Based on the search results provided, I do not have definitive information about the most recent version of the ServiceNow API. The search results do not contain specific details about API versions. However, I can provide some general information about ServiceNow releases and versioning:
Key Points:
-
ServiceNow typically releases two major platform versions per year [4].
-
The releases are named after cities alphabetically (e.g. Tokyo, Utah, Vancouver) [4].
-
ServiceNow generally supports the current release and the previous release [4].
-
As of early 2024, the current release is Vancouver, with Utah and Tokyo being the previous supported releases [4].
-
The next planned release after Vancouver is expected to be Washington D.C. [4].
Best Practices:
-
Stay current with ServiceNow releases to take advantage of new features and security updates [4].
-
Plan to upgrade approximately once per year to stay on a supported release [4].
-
Check the official ServiceNow documentation for the most up-to-date information on releases and API versions.
While I don't have specific API version information, the API typically aligns with the major platform releases. To get the most recent API version, you would want to refer to the documentation for the current Vancouver release or check the ServiceNow developer resources for the latest API details.
How to get a ServiceNow developer account and API Keys?
- Create a developer account:
- Go to https://developer.servicenow.com/ and select "Create an Account"
- Register for a free account
- Request a developer instance:
- Log in to your developer account
- Select "Request an Instance"
- Choose the latest ServiceNow release version available
- Your developer instance will be created in seconds
- Set up API access:
- Log in to your developer instance
- Create a new user to be used as a service account for API access
- Grant the user roles like "itil" and "snc_platform_rest_api_access"
- Configure API authentication:
- For basic authentication, you can use the service account username/password
- For production, use a more secure method like OAuth (work with your ServiceNow team on this)
- Test the API connection:
- Use a tool like Postman or a script to test making API calls to your instance
- Example PowerShell script to test:
$cred = Get-Credential
$results = Invoke-WebRequest -Uri "https://[your-instance].service-now.com/api/now/table/incident?sysparm_limit=1" -Method Get -Credential $cred
($results.content | ConvertFrom-Json).Result
- Develop your integration:
- Use the REST API Explorer in ServiceNow to explore available endpoints
- Build your integration logic to fetch data, create tickets, etc. based on your requirements
What can you do with the ServiceNow API?
Here are the key data models you can interact with using the ServiceNow API:
• Tables
- Definition: Primary structure for storing data in ServiceNow
- Types: Base tables (core ServiceNow tables) and extended tables (custom tables)
- Can create, read, update, and delete records in tables via API
• Fields
- Individual data elements within table records
- Common types: string, integer, date/time, reference, choice lists
- Can get/set field values via API
• Relationships
- Reference fields create relationships between tables
- One-to-many and many-to-many relationships possible
- Can traverse relationships and create/modify them via API
• Configuration Items (CIs)
- Represent IT assets and services in the CMDB
- Specialized data model for configuration management
- Can create, update, query CI data via API
• Business Rules
- Server-side scripts that run on database operations
- Can be triggered via API operations to tables
• Workflows
- Define multi-step processes and approvals
- Can start/stop workflows and check status via API
• Knowledge Base Articles
- Store and manage knowledge content
- Can create, update, search knowledge via API
• Incidents, Problems, Changes
- Core ITSM processes
- Can create and manage via API
• Users and Groups
- Manage user accounts and group memberships
- Can query and update via API
• Attachments
- Files associated with records
- Can upload, download, delete via API
The API provides access to most data models in ServiceNow, allowing you to interact with and manipulate data across the platform. The specific capabilities depend on the data model, but generally include creating, reading, updating and deleting records.