Knowledge Management REST API
-
- UpdatedAug 1, 2024
- 18 minutes to read
- Xanadu
- API reference
The Knowledge Management API provides endpoints for searching, viewing, and fetching lists of the most-viewed and featured knowledge articles.
You can only use this API when the Knowledge API (sn_km_api) plugin is activated. The Knowledge Management REST API was originally released in Orlando using the Knowledge API app available in the ServiceNow Store.
To enable other domains to use Knowledge Management REST API endpoints, define a Cross-Origin Resource Sharing (CORS) rule. For more information, see Define a CORS rule.
To view an article from the scoped knowledge base using this REST API, allow the sn_km_api scope read access from the requesting scope in the Restricted Caller Access Privileges [sys_restricted_caller_access] table. For more information, see Define cross-scope access to an application resource.
By default, this API has a rate limit of 500 per hour for unauthenticated and snc_external users. For more information about rate limiting, see Inbound REST API rate limiting.
Knowledge Management - GET /knowledge/articles
Returns a list of knowledge base (KB) articles which can be searched and filtered using various parameters.
URL format
Versioned URL: /api/sn_km_api/{api_version}/knowledge/articles
Default URL: /api/sn_km_api/knowledge/articles
Supported request parameters
Name | Description |
---|---|
api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
Name | Description |
---|---|
None |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
Header | Description |
---|---|
Accept | Data format of the response
body. Supported types: application/json or
application/xml.
Default: application/json |
Header | Description |
---|---|
None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
Status code | Description |
---|---|
200 | Successful. The request was successfully processed. |
401 | Unauthorized. The user credentials are incorrect or have not been passed. |
500 | Internal server error. An unexpected error occurred while processing the request. |
Response body parameters (JSON or XML)
Example: cURL request
Knowledge Management - GET /knowledge/articles/{article_sys_id}/attachments/{attachment_sys_id}
Returns a knowledge article attachment as a file.
URL format
Versioned URL: /api/sn_km_api/{api_version}/knowledge/articles/{article_sys_id}/attachments/{attachment_sys_id}
Default URL: /api/sn_km_api/knowledge/articles/{article_sys_id}/attachments/{attachment_sys_id}
Supported request parameters
Name | Description |
---|---|
api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
article_sys_id | Sys_id of the knowledge article with the attachment you intend to retrieve.
Located in the Knowledge Bases [kb_knowledge] table. Data type: String |
attachment_sys_id | Sys_id of record to which the attachment belongs. Data type: String |
Name | Description |
---|---|
None |
Name | Description |
---|---|
None |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
Header | Description |
---|---|
Accept | Data format of the response
body. Supported types: application/json or
application/xml.
Default: application/json |
Header | Description |
---|---|
Content-Type | The content type of the response, for example, image/gif or */*. |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
Response body parameters
Name | Description |
---|---|
File is returned as a response. |
Example: Sample cURL request
Knowledge Management - GET /knowledge/articles/featured
Returns a list of the most-viewed knowledge articles and featured knowledge articles.
URL format
Versioned URL: /api/sn_km_api/{api_version}/knowledge/articles/featured
Default URL: /api/sn_km_api/knowledge/articles/featured
Supported request parameters
Name | Description |
---|---|
api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
Name | Description |
---|---|
None |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
Header | Description |
---|---|
Accept | Data format of the response
body. Supported types: application/json or
application/xml.
Default: application/json |
Header | Description |
---|---|
None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
Status code | Description |
---|---|
200 | Successful. The request was successfully processed. |
401 | Unauthorized. The user credentials are incorrect or have not been passed. |
500 | Internal server error. An unexpected error occurred while processing the request. |
Response body parameters (JSON or XML)
Example: cURL request
Knowledge Management - GET /knowledge/articles/{id}
Returns specific knowledge article content and its field values.
URL format
Versioned URL: /api/sn_km_api/{api_version}/knowledge/articles/{id}
Default URL: /api/sn_km_api/knowledge/articles/{id}
Supported request parameters
Name | Description |
---|---|
api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
id | Sys_id or knowledge base (KB) number of a knowledge article in the Knowledge
[kb_knowledge] table. Data type: String |
Name | Description |
---|---|
None |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
Header | Description |
---|---|
Accept | Data format of the response
body. Supported types: application/json or
application/xml.
Default: application/json |
Header | Description |
---|---|
None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
Status code | Description |
---|---|
200 | Successful. The request was successfully processed. |
401 | Unauthorized. The user credentials are incorrect or have not been passed. |
500 | Internal server error. An unexpected error occurred while processing the request. |
Response body parameters (JSON or XML)
Example: cURL request
Example: Sample cURL request (update_view)
Knowledge Management - GET knowledge/articles/most_viewed
Returns a list of knowledge articles prioritized by most-viewed.
URL format
Versioned URL: /api/sn_km_api/{api_version}/knowledge/articles/most_viewed
Default URL: /api/sn_km_api/knowledge/articles/most_viewed
Supported request parameters
Name | Description |
---|---|
api_version | Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the
latest.
Data type: String |
Name | Description |
---|---|
None |
Headers
The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.
Header | Description |
---|---|
Accept | Data format of the response
body. Supported types: application/json or
application/xml.
Default: application/json |
Header | Description |
---|---|
None |
Status codes
The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.
Status code | Description |
---|---|
200 | Successful. The request was successfully processed. |
401 | Unauthorized. The user credentials are incorrect or have not been passed. |
500 | Internal server error. An unexpected error occurred while processing the request. |
Response body parameters (JSON or XML)
Example: cURL request
On this page
- Knowledge Management - GET /knowledge/articles
- Knowledge Management - GET /knowledge/articles/{article_sys_id}/attachments/{attachment_sys_id}
- Knowledge Management - GET /knowledge/articles/featured
- Knowledge Management - GET /knowledge/articles/{id}
- Knowledge Management - GET knowledge/articles/most_viewed