{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":520,"path":"api-reference/rest-apis/knowledge-api.md","title":"Knowledge Management REST API","bundle":null,"doc_type":null,"release":"australia","body":"\n# Knowledge Management REST API\n\nThe Knowledge Management API provides endpoints for searching, viewing, and fetching lists of the most-viewed and featured knowledge articles.\n\nYou 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.\n\n**Note:** The Knowledge Management REST API is publicly accessible and makes any knowledge base that is publicly accessible available to all users, including unauthenticated users. For version 1.0.1 and later, the API was made editable, allowing admins to configure each endpoint to disallow unauthenticated access by selecting the **Requires Authentication** flag on the Scripted REST Service Security tab associated with the API.\n\nTo 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](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/t_DefineACORSRule.md).\n\nTo 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](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/application-development/set-RCA-level.md).\n\nBy 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](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/inbound-REST-API-rate-limiting.md).\n\n**Parent Topic:**[REST API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-apis/api-rest.md)\n\n## Knowledge Management - GET /knowledge/articles\n\nReturns a list of knowledge base \\(KB\\) articles which can be searched and filtered using various parameters.\n\n### URL format\n\nVersioned URL: `/api/sn_km_api/{api_version}/knowledge/articles`\n\nDefault URL: `/api/sn_km_api/knowledge/articles`\n\n**Note:** Available versions are specified in the [REST API Explorer](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/use-REST-API-Explorer.md). For scripted REST APIs there is additional version information on the [Scripted REST Service form](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/c_CustomWebServices.md).\n\n### Supported request parameters\n\n<table class=\"rest_api_path_parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\napi\\_version\n\n</td><td id=\"version-entry-RESTAPI\">\n\nOptional. 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\n\n</td></tr></tbody>\n</table><table class=\"rest_api_query_parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nfilter\n\n</td><td>\n\nEncoded query to use to filter the result set. Syntax: `filter=<attr><operator><value>`.\n\n -   `<attr>`: Name of the table column.\n-   `<operator>`:\n\nValid values:\n\n    -   =: Exactly matches &lt;value&gt;.\n    -   !=: Does not match &lt;value&gt;.\n    -   ^: Enables you to specify more than one condition and logically AND them.\n    -   ^OR: Enables you to specify more than one condition and logically OR them.\n    -   LIKE: &lt;attr&gt; contains the specified string. Only works for &lt;attr&gt; fields whose data type is string.\n    -   STARTSWITH: &lt;attr&gt; starts with the specified string. Only works for &lt;attr&gt; fields whose data type is string.\n    -   ENDSWITH: &lt;attr&gt; ends with the specified string. Only works for &lt;attr&gt; fields whose data type is string.\n-   `<value>`: Value to match against.\n\n All parameters are case-sensitive. Query can contain more than one entry, such as `filter=<attr><operator><value>[<operator><attr><operator><value>]`.\n\n Data type: String\n\n Default: empty\n\n</td></tr><tr><td>\n\nfields\n\n</td><td>\n\nComma-separated list of fields from the Knowledge \\[kb\\_knowledge\\] table to show details in results.Data type: String\n\n Default: None\n\n</td></tr><tr><td>\n\nkb\n\n</td><td>\n\nComma-separated list of knowledge base sys\\_ids from the Knowledge Bases \\[kb\\_knowledge\\_base\\] table to restrict results to.Data type: String\n\n</td></tr><tr id=\"km-api-parm-lang\"><td>\n\nlanguage\n\n</td><td>\n\nList of comma-separated languages in two-letter ISO 639-1 language code format to restrict results to. Alternatively type 'all' to search in all valid installed languages on an instance.Data type: String\n\n Default: User's session language or en\n\n</td></tr><tr><td>\n\nlimit\n\n</td><td>\n\nMaximum number of records to return. Unusually large **limit** values can impact system performance. For requests that exceed this number of records, use the **offset** parameter to paginate record retrieval.Data type: Number\n\n Default: 30\n\n</td></tr><tr id=\"km-api-parm-off\"><td>\n\noffset\n\n</td><td>\n\nStarting record index for which to begin retrieving records. Use this value to paginate record retrieval. This functionality enables the retrieval of all records, regardless of the number of records, in small manageable chunks. For example, the first time this endpoint is called, **offset** is set to \"0\". To page through all available records, use `offset=offset+limit` until the end of the all records is reached.\n\n Data type: Number\n\n Default: 0\n\n</td></tr><tr><td>\n\nquery\n\n</td><td>\n\nText to search for, can be empty.Data type: String\n\n</td></tr></tbody>\n</table>|Name|Description|\n|----|-----------|\n|None| |\n\n### Headers\n\nThe 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](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/c_RESTAPI.md).\n\n<table class=\"rest_api_request_headers\"><thead><tr><th>\n\nHeader\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nAccept\n\n</td><td id=\"accept-entry-RESTAPI\">\n\nData format of the response body. Supported types: **application/json** or **application/xml**. Default: **application/json**\n\n</td></tr></tbody>\n</table>|Header|Description|\n|------|-----------|\n|None| |\n\n### Status codes\n\nThe 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](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/c_RESTAPI.md).\n\n|Status code|Description|\n|-----------|-----------|\n|200|Successful. The request was successfully processed.|\n|401|Unauthorized. The user credentials are incorrect or have not been passed.|\n|500|Internal server error. An unexpected error occurred while processing the request.|\n\n### Response body parameters \\(JSON or XML\\)\n\n<table><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\narticles\n\n</td><td>\n\nList of articles returned in response.Data type: Array\n\n ```\n\"articles\": [\n  {\n    \"fields\": {Object},\n    \"link\": \"String\",\n    \"id\": \"String\",\n    \"number\": \"String\",\n    \"rank\": Number,\n    \"score\": Number,\n    \"snippet\": \"String\",\n    \"title\": \"String\"\n  }\n]\n```\n\n</td></tr><tr><td>\n\narticles.fields\n\n</td><td id=\"km-resp-fields\">\n\nValues of requested fields, if any.Data type: Object\n\n ```\n\"fields\": {\n  \"<field_name>\": {Object}\n}\n```\n\n</td></tr><tr><td>\n\narticles.fields.&lt;field\\_name&gt;\n\n</td><td id=\"km-resp-fields_fieldname\">\n\nLists each field requested using the fields parameter, if any.Data type: Object\n\n ```\n\"<field_name>\": {\n  \"display_value\": \"String\",\n  \"label\": \"String\",\n  \"name\": \"String\",\n  \"type\": \"String\",\n  \"value\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\narticles.fields.&lt;field\\_name&gt;.display\\_value\n\n</td><td id=\"km-resp-fieldName-display\">\n\nDisplay value of the requested field.Data type: String\n\n</td></tr><tr><td>\n\narticles.fields.&lt;field\\_name&gt;.label\n\n</td><td id=\"km-resp-fieldName-label\">\n\nLabel representing the requested field. For example, `Knowledge`.Data type: String\n\n</td></tr><tr><td>\n\narticles.fields.&lt;field\\_name&gt;.name\n\n</td><td id=\"km-resp-fieldName-name\">\n\nName of the requested field. Matches **&lt;field\\_name&gt;**.Data type: String\n\n</td></tr><tr><td>\n\narticles.fields.&lt;field\\_name&gt;.type\n\n</td><td id=\"km-resp-fieldName-type\">\n\nData type of requested field.Data type: String\n\n</td></tr><tr><td>\n\narticles.fields.&lt;field\\_name&gt;.value\n\n</td><td id=\"km-resp-fields-fieldName-val\">\n\nValue of the requested field.Data type: String\n\n</td></tr><tr><td>\n\narticles.id\n\n</td><td id=\"km_kb_id\">\n\nKnowledge article sys\\_id from the Knowledge \\[kb\\_knowledge\\] table.Data type: String\n\n</td></tr><tr><td>\n\narticles.link\n\n</td><td>\n\nLink to the article.Data type: String\n\n</td></tr><tr><td>\n\narticles.number\n\n</td><td>\n\nKnowledge article number.Data type: String\n\n</td></tr><tr><td>\n\narticles.rank\n\n</td><td>\n\nSearch rank of article specific to this search.Data type: Number \\(Float\\)\n\n</td></tr><tr><td>\n\narticles.snippet\n\n</td><td>\n\nText showing a small portion of the knowledge article.Data type: String\n\n</td></tr><tr><td>\n\narticles.score\n\n</td><td>\n\nRelevancy score, results sorted in descending order by score.Data type: String\n\n</td></tr><tr><td>\n\narticles.title\n\n</td><td id=\"km_kb_sdesc\">\n\nShort description or title of the knowledge article.Data type: String\n\n</td></tr><tr><td>\n\nmeta\n\n</td><td>\n\nMeta information of the results and request parameters.Data type: Object\n\n ```\n\"meta\": {\n  \"count\": Number,\n  \"end\": Number,\n  \"fields\": \"String\",\n  \"filter\": \"String\",\n  \"kb\": \"String\",\n  \"language\": \"String\",\n  \"query\": \"String\",\n  \"start\": Number,\n  \"status\": {Object},\n  \"ts_query_id\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\nmeta.count\n\n</td><td>\n\nNumber of available KB articles.Data type: Number\n\n</td></tr><tr><td>\n\nmeta.end\n\n</td><td>\n\nEnding index of the result set.Data type: Number\n\n</td></tr><tr><td>\n\nmeta.fields\n\n</td><td>\n\nFields in the article.Data type: String\n\n</td></tr><tr><td>\n\nmeta.filter\n\n</td><td>\n\nFilter used to acquire the data.Data type: String\n\n</td></tr><tr><td>\n\nmeta.kb\n\n</td><td>\n\nList of knowledge base article sys\\_ids.Data type: String\n\n</td></tr><tr><td>\n\nmeta.language\n\n</td><td>\n\nList of comma-separated languages of the KB articles that were requested.Data type: String\n\n</td></tr><tr><td>\n\nmeta.query\n\n</td><td>\n\nSpecified request query.Data type: String\n\n</td></tr><tr><td>\n\nmeta.start\n\n</td><td>\n\nStarting index of result set.Data type: Number\n\n</td></tr><tr><td>\n\nmeta.status\n\n</td><td>\n\nStatus of the call.Data type: String\n\n</td></tr><tr><td>\n\nmeta.ts\\_query\\_id\n\n</td><td>\n\nSys\\_id of the query.Data type: String\n\n</td></tr></tbody>\n</table>### cURL request\n\n```\ncurl \"https://instance.servicenow.com/api/sn_km_api/knowledge/articles?query=Windows&limit=2&fields=short_description&fields=sys_class_name\" \\\n--request GET \\\n--header \"Accept:application/xml\" \\\n--user \"username\":\"password\"\n```\n\n```\n{\n  \"result\": {\n    \"meta\": {\n      \"start\": 0,\n      \"end\": 2,\n      \"fields\": \"short_description,sys_class_name\",\n      \"query\": \"Windows\",\n      \"filter\": \"\",\n      \"kb\": \"\",\n      \"language\": \"en\",\n      \"count\": 19,\n      \"ts_query_id\": \"7976f36129c30410f877796e70786991\",\n      \"status\": {\n        \"code\": 200\n      }\n    },\n    \"articles\": [\n      {\n        \"link\": \"?sys_kb_id=9e528db1474321009db4b5b08b9a71a6&id=kb_article_view&sysparm_rank=1&sysparm_tsqueryId=7976f36129c30410f877796e70786991\",\n        \"rank\": 1,\n        \"id\": \"kb_knowledge:9e528db1474321009db4b5b08b9a71a6\",\n        \"title\": \"Windows: Should I upgrade to Windows 8.x?\",\n        \"snippet\": \"    Should I upgrade to <B>Windows</B> 8.x? <B>Windows</B> 8.x is designed for using touch, mouse, and keyboard the <B>Windows</B> Store and access apps such as Calendar, Mail, and Messaging. By most accounts, <B>Windows</B> boot times, smaller memory footprint, and more free memory for the programs you run. <B>Windows</B>\",\n        \"score\": 14.869,\n        \"number\": \"KB0000020\",\n        \"fields\": {\n          \"short_description\": {\n            \"display_value\": \"Windows: Should I upgrade to Windows 8.x?\\n\\t\\t\",\n            \"name\": \"short_description\",\n            \"label\": \"Short description\",\n            \"type\": \"string\",\n            \"value\": \"Windows: Should I upgrade to Windows 8.x?\\n\\t\\t\"\n          },\n          \"sys_class_name\": {\n            \"display_value\": \"Knowledge\",\n            \"name\": \"sys_class_name\",\n            \"label\": \"Class\",\n            \"type\": \"sys_class_name\",\n            \"value\": \"kb_knowledge\"\n          }\n        }\n      },\n      {\n        \"link\": \"?sys_kb_id=3b07857187032100deddb882a2e3ec20&id=kb_article_view&sysparm_rank=2&sysparm_tsqueryId=7976f36129c30410f877796e70786991\",\n        \"rank\": 2,\n        \"id\": \"kb_knowledge:3b07857187032100deddb882a2e3ec20\",\n        \"title\": \"What is the Windows key?\",\n        \"snippet\": \"What is the <B>Windows</B> key? The <B>Windows</B> key is a standard key on most keyboards on computers built to use a <B>Windows</B> operating system. It is labeled with a <B>Windows</B> logo, and is usually placed between on the right side as well. Pressing Win (the <B>Windows</B> key) on its own will do the following: <B>Windows</B> 8.x: Toggle\",\n        \"score\": 13.4826,\n        \"number\": \"KB0000017\",\n        \"fields\": {\n          \"short_description\": {\n            \"display_value\": \"What is the Windows key?\\t\\t\",\n            \"name\": \"short_description\",\n            \"label\": \"Short description\",\n            \"type\": \"string\",\n            \"value\": \"What is the Windows key?\\t\\t\"\n          },\n          \"sys_class_name\": {\n            \"display_value\": \"Knowledge\",\n            \"name\": \"sys_class_name\",\n            \"label\": \"Class\",\n            \"type\": \"sys_class_name\",\n            \"value\": \"kb_knowledge\"\n          }\n        }\n      }\n    ]\n  }\n}\n\n```\n\n## Knowledge Management - GET /knowledge/articles/\\{article\\_sys\\_id\\}/attachments/\\{attachment\\_sys\\_id\\}\n\nReturns a knowledge article attachment as a file.\n\n### URL format\n\nVersioned URL: `/api/sn_km_api/{api_version}/knowledge/articles/{article_sys_id}/attachments/{attachment_sys_id}`\n\nDefault URL: `/api/sn_km_api/knowledge/articles/{article_sys_id}/attachments/{attachment_sys_id}`\n\n**Note:** Available versions are specified in the [REST API Explorer](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/use-REST-API-Explorer.md). For scripted REST APIs there is additional version information on the [Scripted REST Service form](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/c_CustomWebServices.md).\n\n### Supported request parameters\n\n<table class=\"rest_api_path_parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\napi\\_version\n\n</td><td id=\"version-entry-RESTAPI\">\n\nOptional. 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\n\n</td></tr><tr><td>\n\narticle\\_sys\\_id\n\n</td><td>\n\nSys\\_id of the knowledge article with the attachment you intend to retrieve.Data type: String\n\nTable: Knowledge Bases \\[kb\\_knowledge\\]\n\n</td></tr><tr><td>\n\nattachment\\_sys\\_id\n\n</td><td>\n\nSys\\_id of record to which the attachment belongs.Data type: String\n\n</td></tr></tbody>\n</table>|Name|Description|\n|----|-----------|\n|None| |\n\n|Name|Description|\n|----|-----------|\n|None| |\n\n### Headers\n\nThe 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](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/c_RESTAPI.md).\n\n<table class=\"rest_api_request_headers\"><thead><tr><th>\n\nHeader\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nAccept\n\n</td><td id=\"accept-entry-RESTAPI\">\n\nData format of the response body. Supported types: **application/json** or **application/xml**. Default: **application/json**\n\n</td></tr></tbody>\n</table>|Header|Description|\n|------|-----------|\n|Content-Type|The content type of the response, for example, `image/gif` or `*/*`.|\n\n### Status codes\n\nThe 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](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/c_RESTAPI.md).\n\n|Status code|Description|\n|-----------|-----------|\n|200|Successful. The request was successfully processed.|\n|401|Unauthorized. The user credentials are incorrect or have not been passed.|\n|404|Not found. The requested item wasn't found.|\n|500|Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.|\n\n### Response body parameters\n\n|Name|Description|\n|----|-----------|\n|File is returned as a response.| |\n\n### Sample cURL request\n\n```\ncurl \"https://instance.service-now.com/api/sn_km_api/knowledge/articles/0b48fd75474321009db4b5b08b9a71c2/attachments/fedf5614294f4010f877796e70786956\" \\\n--request GET \\\n--header \"Accept:*/*\" \\\n--user \"username\":\"password\"\n```\n\n```\nBinary response not shown (file is returned as a response).\n```\n\n## Knowledge Management - GET /knowledge/articles/featured\n\nReturns a list of the most-viewed knowledge articles and featured knowledge articles.\n\n### URL format\n\nVersioned URL: `/api/sn_km_api/{api_version}/knowledge/articles/featured`\n\nDefault URL: `/api/sn_km_api/knowledge/articles/featured`\n\n**Note:** Available versions are specified in the [REST API Explorer](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/use-REST-API-Explorer.md). For scripted REST APIs there is additional version information on the [Scripted REST Service form](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/c_CustomWebServices.md).\n\n### Supported request parameters\n\n<table class=\"rest_api_path_parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\napi\\_version\n\n</td><td id=\"version-entry-RESTAPI\">\n\nOptional. 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\n\n</td></tr></tbody>\n</table><table class=\"rest_api_query_parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr id=\"km-api-parm-fields\"><td>\n\nfields\n\n</td><td>\n\nComma-separated list of fields from the Knowledge \\[kb\\_knowledge\\] table to show details in results.Data type: String\n\n Default: None\n\n</td></tr><tr id=\"km-api-parm-kb\"><td>\n\nkb\n\n</td><td>\n\nComma-separated list of knowledge base sys\\_ids from the Knowledge Bases \\[kb\\_knowledge\\_base\\] table to restrict results to.Data type: String\n\n</td></tr><tr id=\"km-api-parm-lang\"><td>\n\nlanguage\n\n</td><td>\n\nList of comma-separated languages in two-letter ISO 639-1 language code format to restrict results to. Alternatively type 'all' to search in all valid installed languages on an instance.Data type: String\n\n Default: User's session language or en\n\n</td></tr><tr id=\"km-api-parm-limit\"><td>\n\nlimit\n\n</td><td>\n\nMaximum number of records to return. Unusually large **limit** values can impact system performance. For requests that exceed this number of records, use the **offset** parameter to paginate record retrieval.Data type: Number\n\n Default: 30\n\n</td></tr><tr id=\"km-api-parm-off\"><td>\n\noffset\n\n</td><td>\n\nStarting record index for which to begin retrieving records. Use this value to paginate record retrieval. This functionality enables the retrieval of all records, regardless of the number of records, in small manageable chunks. For example, the first time this endpoint is called, **offset** is set to \"0\". To page through all available records, use `offset=offset+limit` until the end of the all records is reached.\n\n Data type: Number\n\n Default: 0\n\n</td></tr></tbody>\n</table>|Name|Description|\n|----|-----------|\n|None| |\n\n### Headers\n\nThe 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](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/c_RESTAPI.md).\n\n<table class=\"rest_api_request_headers\"><thead><tr><th>\n\nHeader\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nAccept\n\n</td><td id=\"accept-entry-RESTAPI\">\n\nData format of the response body. Supported types: **application/json** or **application/xml**. Default: **application/json**\n\n</td></tr></tbody>\n</table>|Header|Description|\n|------|-----------|\n|None| |\n\n### Status codes\n\nThe 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](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/c_RESTAPI.md).\n\n|Status code|Description|\n|-----------|-----------|\n|200|Successful. The request was successfully processed.|\n|401|Unauthorized. The user credentials are incorrect or have not been passed.|\n|500|Internal server error. An unexpected error occurred while processing the request.|\n\n### Response body parameters \\(JSON or XML\\)\n\n<table><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\narticles\n\n</td><td>\n\nList of articles returned in response.Data type: Array\n\n ```\n\"articles\":[\n  {\n    \"fields\": {Object},\n    \"id\": \"String\",\n    \"link\": \"String\",\n    \"number\": \"String\",\n    \"rank\": Number,\n    \"score\": Number,\n    \"snippet\": \"String\",\n    \"title\": \"String\"\n  }\n]\n```\n\n</td></tr><tr><td>\n\narticles.fields\n\n</td><td id=\"km-resp-fields\">\n\nValues of requested fields, if any.Data type: Object\n\n ```\n\"fields\": {\n  \"<field_name>\": {Object}\n}\n```\n\n</td></tr><tr><td>\n\narticles.fields.&lt;field\\_name&gt;\n\n</td><td id=\"km-resp-fields_fieldname\">\n\nLists each field requested using the fields parameter, if any.Data type: Object\n\n ```\n\"<field_name>\": {\n  \"display_value\": \"String\",\n  \"name\": \"String\",\n  \"label\": \"String\",\n  \"type\": \"String\",\n  \"value\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\narticles.fields.&lt;field\\_name&gt;.display\\_value\n\n</td><td id=\"km-resp-fieldName-display\">\n\nDisplay value of the requested field.Data type: String\n\n</td></tr><tr><td>\n\narticles.fields.&lt;field\\_name&gt;.name\n\n</td><td id=\"km-resp-fieldName-name\">\n\nName of the requested field. Matches **&lt;field\\_name&gt;**.Data type: String\n\n</td></tr><tr><td>\n\narticles.fields.&lt;field\\_name&gt;.label\n\n</td><td id=\"km-resp-fieldName-label\">\n\nLabel representing the requested field. For example, `Knowledge`.Data type: String\n\n</td></tr><tr><td>\n\narticles.fields.&lt;field\\_name&gt;.type\n\n</td><td id=\"km-resp-fieldName-type\">\n\nData type of requested field.Data type: String\n\n</td></tr><tr><td>\n\narticles.fields.&lt;field\\_name&gt;.value\n\n</td><td id=\"km-resp-fields-fieldName-val\">\n\nValue of the requested field.Data type: String\n\n</td></tr><tr><td>\n\narticles.id\n\n</td><td id=\"km_kb_id\">\n\nKnowledge article sys\\_id from the Knowledge \\[kb\\_knowledge\\] table.Data type: String\n\n</td></tr><tr><td>\n\narticles.link\n\n</td><td>\n\nLink to the article.Data type: String\n\n</td></tr><tr><td>\n\narticles.number\n\n</td><td>\n\nKnowledge article number.Data type: String\n\n</td></tr><tr><td>\n\narticles.rank\n\n</td><td>\n\nSearch rank of article specific to this search.Data type: Number \\(Float\\)\n\n</td></tr><tr><td>\n\narticles.score\n\n</td><td>\n\nRelevancy score, results sorted in descending order by score.Data type: String\n\n</td></tr><tr><td>\n\narticles.snippet\n\n</td><td>\n\nText showing a small portion of the knowledge article.Data type: String\n\n</td></tr><tr><td>\n\narticles.title\n\n</td><td id=\"km_kb_sdesc\">\n\nShort description or title of the knowledge article.Data type: String\n\n</td></tr><tr><td>\n\nmeta\n\n</td><td>\n\nMeta information of the results and request parameters.Data type: Object\n\n ```\n\"meta\": {\n  \"count\": Number,\n  \"end\": Number,\n  \"fields\": \"String\",\n  \"filter\": \"String\",\n  \"kb\": \"String\",\n  \"language\": \"String\",\n  \"query\": \"String\",\n  \"start\": Number,\n  \"status\": {Object},\n  \"ts_query_id\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\nmeta.count\n\n</td><td>\n\nNumber of available KB articles.Data type: Number\n\n</td></tr><tr><td>\n\nmeta.end\n\n</td><td>\n\nEnding index of the result set.Data type: Number\n\n</td></tr><tr><td>\n\nmeta.fields\n\n</td><td>\n\nFields in the article.Data type: String\n\n</td></tr><tr><td>\n\nmeta.filter\n\n</td><td>\n\nFilter used to acquire the data.Data type: String\n\n</td></tr><tr><td>\n\nmeta.kb\n\n</td><td>\n\nList of knowledge base article sys\\_ids.Data type: String\n\n</td></tr><tr><td>\n\nmeta.language\n\n</td><td>\n\nList of comma-separated languages of the KB articles that were requested.Data type: String\n\n</td></tr><tr><td>\n\nmeta.query\n\n</td><td>\n\nSpecified request query.Data type: String\n\n</td></tr><tr><td>\n\nmeta.start\n\n</td><td>\n\nStarting index of result set.Data type: Number\n\n</td></tr><tr><td>\n\nmeta.status\n\n</td><td>\n\nHTTP status of the call.Data type: String\n\n</td></tr><tr><td>\n\nmeta.ts\\_query\\_id\n\n</td><td>\n\nSys\\_id of the query.Data type: String\n\n</td></tr></tbody>\n</table>### cURL request\n\n```\ncurl \"https://instance.servicenow.com/api/sn_km_api/knowledge/articles/featured?fields=short_description&limit=3\" \\\n--request GET \\\n--header \"Accept:application/json\" \\\n--user \"username\":\"password\"\n```\n\n```\n{\n  \"result\": {\n    \"meta\": {\n      \"start\": 0,\n      \"end\": 3,\n      \"fields\": \"short_description\",\n      \"query\": \"homepage\",\n      \"filter\": \"\",\n      \"kb\": \"\",\n      \"language\": \"en\",\n      \"status\": {\n        \"code\": 200\n      },\n      \"count\": 2\n    },\n    \"articles\": [\n      {\n        \"link\": \"?id=kb_article_view&sys_kb_id=f27d7f79c0a8011b0018f9d700d2b9aa\",\n        \"id\": \"kb_knowledge:f27d7f79c0a8011b0018f9d700d2b9aa\",\n        \"title\": \"Email Interruption Tonight at 11:00 PM Eastern\",\n        \"snippet\": \" If the site is UP but you cant access the page, try one of the below solutions: Browser Related Problems Force a full refresh for the site. This can be achieved by pressing CTRL + F5 keys at the same time on your favourite browser (Firefox, Chrome, Explorer, etc.) Try alternative urls such as m.outlook.com Clear the temporary cache and cookies \",\n        \"score\": -1,\n        \"number\": \"KB0000002\",\n        \"fields\": {\n          \"short_description\": {\n            \"display_value\": \"Email Interruption Tonight at 11:00 PM Eastern\\n\\t\\t\",\n            \"name\": \"short_description\",\n            \"label\": \"Short description\",\n            \"type\": \"string\",\n            \"value\": \"Email Interruption Tonight at 11:00 PM Eastern\\n\\t\\t\"\n          }\n        }\n      },\n      {\n        \"link\": \"?id=kb_article_view&sys_kb_id=f2765f9fc0a8011b0120ec1b352bf09b\",\n        \"id\": \"kb_knowledge:f2765f9fc0a8011b0120ec1b352bf09b\",\n        \"title\": \"Sales Force Automation is DOWN\",\n        \"snippet\": \"  On Friday, January 20th, we experienced a widespread outage that affected all Zoho services. The outage started around 8:13 am Pacific Time. Zoho services started coming back online for customer use at 3:49 pm, and all services were fully restored at 6:22 pm PST. We absolutely realize how important our services are for businesses and users who\",\n        \"score\": -1,\n        \"number\": \"KB0000001\",\n        \"fields\": {\n          \"short_description\": {\n            \"display_value\": \"Sales Force Automation is DOWN\",\n            \"name\": \"short_description\",\n            \"label\": \"Short description\",\n            \"type\": \"string\",\n            \"value\": \"Sales Force Automation is DOWN\"\n          }\n        }\n      }\n    ]\n  }\n}\n\n```\n\n## Knowledge Management - GET /knowledge/articles/\\{id\\}\n\nReturns specific knowledge article content and its field values.\n\n### URL format\n\nVersioned URL: `/api/sn_km_api/{api_version}/knowledge/articles/{id}`\n\nDefault URL: `/api/sn_km_api/knowledge/articles/{id}`\n\n**Note:** Available versions are specified in the [REST API Explorer](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/use-REST-API-Explorer.md). For scripted REST APIs there is additional version information on the [Scripted REST Service form](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/c_CustomWebServices.md).\n\n### Supported request parameters\n\n<table class=\"rest_api_path_parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\napi\\_version\n\n</td><td id=\"version-entry-RESTAPI\">\n\nOptional. 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\n\n</td></tr><tr><td>\n\nid\n\n</td><td>\n\nSys\\_id or knowledge base \\(KB\\) number of a knowledge article.Data type: String\n\nTable: Knowledge \\[kb\\_knowledge\\]\n\n</td></tr></tbody>\n</table><table class=\"rest_api_query_parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr id=\"km-api-parm-fields\"><td>\n\nfields\n\n</td><td>\n\nComma-separated list of fields from the Knowledge \\[kb\\_knowledge\\] table to show details in results.Data type: String\n\nDefault: None\n\n</td></tr><tr><td>\n\nlanguage\n\n</td><td>\n\nTwo letter ISO 639-1 language code; for example, \"fr\" for French. Results display only when searches use the knowledge article KB number as the **id** and a translated version of the article is available in the language specified.**Note:** Only valid when setting the **id** parameter as a KB number \\(not sys\\_id\\).\n\nData type: String\n\n</td></tr><tr><td>\n\nsearch\\_id\n\n</td><td>\n\nOptional unless using **search\\_rank**. Unique identifier of search that returned this article.You can retrieve **search\\_id** using one of the following APIs that returns the **articles.id** element:\n\n-   [Knowledge Management - GET /knowledge/articles](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-apis/knowledge-api.md)\n-   [Knowledge Management - GET /knowledge/articles/featured](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-apis/knowledge-api.md)\n-   [Knowledge Management - GET knowledge/articles/most\\_viewed](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-apis/knowledge-api.md)\n\nPassing the **search\\_id** and **search\\_rank** parameter increments the article view count and records an entry for the article in the Knowledge Use \\[kb\\_use\\] table. You can also verify incremented view counts in Knowledge Base \\[kb\\_view2\\] page.\n\nData type: String\n\n</td></tr><tr><td>\n\nsearch\\_rank\n\n</td><td>\n\nOptional unless using **search\\_id**. Article [search rank](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/platform-administration/c_DocumentScoring.md) by click-rate that you can retrieve using one of the following APIs that returns the **articles.rank** element:-   [Knowledge Management - GET /knowledge/articles](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-apis/knowledge-api.md)\n-   [Knowledge Management - GET /knowledge/articles/featured](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-apis/knowledge-api.md)\n-   [Knowledge Management - GET knowledge/articles/most\\_viewed](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-apis/knowledge-api.md)\n\nData type: Number\n\n</td></tr><tr><td>\n\nupdate\\_view\n\n</td><td>\n\nUpdate view count and record an entry for the article in the Knowledge Use \\[kb\\_use\\] table. True whether present as a standalone parameter or set to true. **Note:** If you pass **update\\_view** with **search\\_id** and **search\\_rank**, **update\\_view** is ignored because the view count will already be incremented.\n\nData type: Boolean that is always handled as true when passed whether set to `\"true\"`, `\"false\"`, or not set at all.\n\n</td></tr></tbody>\n</table>|Name|Description|\n|----|-----------|\n|None| |\n\n### Headers\n\nThe 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](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/c_RESTAPI.md).\n\n<table class=\"rest_api_request_headers\"><thead><tr><th>\n\nHeader\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nAccept\n\n</td><td id=\"accept-entry-RESTAPI\">\n\nData format of the response body. Supported types: **application/json** or **application/xml**. Default: **application/json**\n\n</td></tr></tbody>\n</table>|Header|Description|\n|------|-----------|\n|None| |\n\n### Status codes\n\nThe 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](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/c_RESTAPI.md).\n\n|Status code|Description|\n|-----------|-----------|\n|200|Successful. The request was successfully processed.|\n|401|Unauthorized. The user credentials are incorrect or have not been passed.|\n|500|Internal server error. An unexpected error occurred while processing the request.|\n\n### Response body parameters \\(JSON or XML\\)\n\n<table><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nattachments\n\n</td><td>\n\nProvides attachment details for each instance if attachment exists.Only displays if `display_attachments = true`.\n\nData type: Array of Objects\n\n```\n\"attachments\": [\n  {\n    \"file_name\": \"String\",\n    \"size_bytes\": \"String\",\n    \"state\": \"String\",\n    \"sys_id\": \"String\"\n  }\n]\n```\n\n</td></tr><tr><td>\n\nattachments.file\\_name\n\n</td><td>\n\nFile name of attachment.Data type: String\n\n</td></tr><tr><td>\n\nattachments.size\\_bytes\n\n</td><td>\n\nFile size.Data type: String\n\nUnit: Bytes\n\n</td></tr><tr><td>\n\nattachments.state\n\n</td><td>\n\nState.Possible values:\n\n-   available\n-   available\\_conditionally\n-   not\\_available\n-   pending\n\nData type: String\n\n</td></tr><tr><td>\n\nattachments.sys\\_id\n\n</td><td>\n\nSys\\_id of the attachment.Data type: String\n\n</td></tr><tr><td>\n\ncontent\n\n</td><td>\n\nEntire HTML content of the article.Data type: String\n\n</td></tr><tr><td>\n\ndisplay\\_attachments\n\n</td><td>\n\nFlag that indicates whether the **display\\_attachments** flag is active for that article. Attachments are returned only if **display\\_attachments** is true \\(active\\) in the knowledge article record.-   true: **display\\_attachments** is active.\n-   false: **display\\_attachments** is inactive.\n\nData type: Boolean\n\n</td></tr><tr><td>\n\nembedded\\_content\n\n</td><td>\n\nLists each attachment containing embedded content by sys\\_id and includes relevant attachment information.Only displays if `display_attachments = true`.\n\nData type: Array of Objects\n\n```\n\"attachments\": [\n  {\n    \"file_name\": \"String\",\n    \"size_bytes\": \"String\",\n    \"state\": \"String\",\n    \"sys_id\": \"String\"\n  }\n]\n```\n\n</td></tr><tr><td>\n\nembedded\\_content.file\\_name\n\n</td><td>\n\nFile name of the attachment.Data type: String\n\n</td></tr><tr><td>\n\nembedded\\_content.size\\_bytes\n\n</td><td>\n\nSize of the attachment.Data type: String\n\nUnit: Bytes\n\n</td></tr><tr><td>\n\nembedded\\_content.state\n\n</td><td>\n\nState of the attachment. Possible values:\n\n-   available\n-   available\\_conditionally\n-   not\\_available\n-   pending\n\nData type: String\n\n</td></tr><tr><td>\n\nembedded\\_content.sys\\_id\n\n</td><td>\n\nSys\\_id of the attachment.Data type: String\n\n</td></tr><tr><td>\n\nfields\n\n</td><td>\n\nValues of requested fields \\(if any\\).Data type: Object\n\n```\n\"fields\": {\n  \"<field_name>\": {Object}\n}\n```\n\n</td></tr><tr><td>\n\nfields.&lt;field\\_name&gt;\n\n</td><td>\n\nLists each field requested using the fields parameter, if any.Data type: Object\n\n```\n\"<field_name>\": {\n  \"display_value\": \"String\",\n  \"label\": \"String\",\n  \"name\": \"String\",\n  \"type\": \"String\",\n  \"value\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\nfields.&lt;field\\_name&gt;.display\\_value\n\n</td><td>\n\nDisplay value of the requested field.Data type: String\n\n</td></tr><tr><td>\n\nfields.&lt;field\\_name&gt;.label\n\n</td><td>\n\nLabel representing the requested field. For example, `Knowledge`.Data type: String\n\n</td></tr><tr><td>\n\nfields.&lt;field\\_name&gt;.name\n\n</td><td>\n\nName of the requested field. Matches **&lt;field\\_name&gt;**.Data type: String\n\n</td></tr><tr><td>\n\nfields.&lt;field\\_name&gt;.type\n\n</td><td>\n\nData type of requested field.Data type: String\n\n</td></tr><tr><td>\n\nfields.&lt;field\\_name&gt;.value\n\n</td><td>\n\nValue of the requested field.Data type: String\n\n</td></tr><tr><td>\n\nlanguage\n\n</td><td>\n\nTwo-letter ISO 639-1 language code for the current article \\(if translation is available\\).Data type: String\n\n</td></tr><tr><td>\n\nlanguages\n\n</td><td>\n\nFor each translated version of a knowledge article \\(if translated\\):```\n\"languages\": [\n  {\n    \"label\": \"String\",\n    \"language\": \"String\",\n    \"sys_id\": \"String\"\n  }\n]\n```\n\n Data type: Array\n\n</td></tr><tr><td>\n\nlanguages.label\n\n</td><td>\n\nString representation for language.Data type: String\n\n</td></tr><tr><td>\n\nlanguages.language\n\n</td><td>\n\nTwo-letter ISO 639-1 code language.Data type: String\n\n</td></tr><tr><td>\n\nlanguages.sys\\_id\n\n</td><td>\n\nUnique identifier for translated version of knowledge article.Data type: String\n\n</td></tr><tr><td>\n\nnumber\n\n</td><td>\n\nArticle number.Data type: String\n\n</td></tr><tr><td>\n\nshort\\_description\n\n</td><td>\n\nShort description or title of the knowledge article.Data type: String\n\n</td></tr><tr><td>\n\nsys\\_id\n\n</td><td>\n\nKnowledge article sys\\_id from the Knowledge \\[kb\\_knowledge\\] table.Data type: String\n\n</td></tr><tr><td>\n\ntemplate\n\n</td><td>\n\nFlag that indicates whether a returned article is a template.Possible values:\n\n-   true: Article is a template.\n-   false: Article is not a template.\n\n Data type: Boolean\n\n</td></tr><tr><td>\n\ntemplate\\_table\n\n</td><td>\n\nName of template table, only returns if knowledge article is a template.Data type: String\n\n</td></tr></tbody>\n</table>### cURL request\n\n```\ncurl \"https://instance.servicenow.com/api/sn_km_api/knowledge/articles/0b48fd75474321009db4b5b08b9a71c2?search_id=spam&search_rank=26.426\" \\\n--request GET \\\n--header \"Accept:application/json\" \\\n--user \"username\":\"password\"\n```\n\n```\n{\n  \"result\": {\n    \"content\": \"<p><span style=\\\"font-size: 18pt;\\\"><strong>How to Deal with Spam</strong></span></p>\\r\\n<p>Spam has increasingly become a problem on the Internet. While every Internet user receives some spam, email  addresses posted to web sites or in newsgroups and chat rooms attract the most spam.</p>\\r\\n<p>To reduce the amount of spam you receive:</p>\\r\\n<p>\n    \"template\": false,\n    \"number\": \"KB0000011\",\n    \"sys_id\": \"0b48fd75474321009db4b5b08b9a71c2\",\n    \"short_description\": \"How to Deal with Spam\",\n    \"display_attachments\": true,\n    \"attachments\": [\n      {\n        \"sys_id\": \"dc27ae18294f4010f877796e707869c8\",\n        \"file_name\": \"image.jpg\",\n        \"size_bytes\": \"66792\",\n        \"state\": \"available_conditionally\"\n      },\n      {\n        \"sys_id\": \"fedf5614294f4010f877796e70786956\",\n        \"file_name\": \"attachment.txt\",\n        \"size_bytes\": \"75\",\n        \"state\": \"available_conditionally\"\n      }\n    ],\n    \"embedded_content\": []\n  }\n}\n```\n\n### Sample cURL request \\(update\\_view\\)\n\n```\ncurl \"https://instance.servicenow.com/api/sn_km_api/knowledge/KB0000020?update_view=' \\\n--request GET \\\n--header \"Accept:application/json\" \\\n--user \"username\":\"password\"\n```\n\n```\n{\n  \"result\": {\n    \"content\": \"<p> </p>\\r\\n<p> </p>\\r\\n<p><strong><span style=\\\"font-size: 18pt;\\\">Should I upgrade to Windows 8.x?</span></strong></p>\\r\\n<p>Windows 8.x is designed for using touch, mouse, and keyboard together, on hardware ranging from touch-enabled tablets and laptops to PCs and all-in-one computers...(intentionally truncated)</p>\",\n    \"template\": false,\n    \"number\": \"KB0000020\",\n    \"sys_id\": \"9e528db1474321009db4b5b08b9a71a6\",\n    \"short_description\": \"Windows: Should I upgrade to Windows 8.x?\\t\\t\",\n    \"display_attachments\": true,\n    \"attachments\": [],\n    \"embedded_content\": []\n  }\n}\n```\n\n## Knowledge Management - GET knowledge/articles/most\\_viewed\n\nReturns a list of knowledge articles prioritized by most-viewed.\n\n### URL format\n\nVersioned URL: `/api/sn_km_api/{api_version}/knowledge/articles/most_viewed`\n\nDefault URL: `/api/sn_km_api/knowledge/articles/most_viewed`\n\n**Note:** Available versions are specified in the [REST API Explorer](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/use-REST-API-Explorer.md). For scripted REST APIs there is additional version information on the [Scripted REST Service form](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/c_CustomWebServices.md).\n\n### Supported request parameters\n\n<table class=\"rest_api_path_parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\napi\\_version\n\n</td><td>\n\nOptional. 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\n\n</td></tr></tbody>\n</table><table class=\"rest_api_query_parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr id=\"km-api-parm-fields\"><td>\n\nfields\n\n</td><td>\n\nComma-separated list of fields from the Knowledge \\[kb\\_knowledge\\] table to show details in results.Data type: String\n\n Default: None\n\n</td></tr><tr id=\"km-api-parm-kb\"><td>\n\nkb\n\n</td><td>\n\nComma-separated list of knowledge base sys\\_ids from the Knowledge Bases \\[kb\\_knowledge\\_base\\] table to restrict results to.Data type: String\n\n</td></tr><tr id=\"km-api-parm-lang\"><td>\n\nlanguage\n\n</td><td>\n\nList of comma-separated languages in two-letter ISO 639-1 language code format to restrict results to. Alternatively type 'all' to search in all valid installed languages on an instance.Data type: String\n\n Default: User's session language or en\n\n</td></tr><tr id=\"km-api-parm-limit\"><td>\n\nlimit\n\n</td><td>\n\nMaximum number of records to return. Unusually large **limit** values can impact system performance. For requests that exceed this number of records, use the **offset** parameter to paginate record retrieval.Data type: Number\n\n Default: 30\n\n</td></tr><tr id=\"km-api-parm-off\"><td>\n\noffset\n\n</td><td>\n\nStarting record index for which to begin retrieving records. Use this value to paginate record retrieval. This functionality enables the retrieval of all records, regardless of the number of records, in small manageable chunks. For example, the first time this endpoint is called, **offset** is set to \"0\". To page through all available records, use `offset=offset+limit` until the end of the all records is reached.\n\n Data type: Number\n\n Default: 0\n\n</td></tr></tbody>\n</table>|Name|Description|\n|----|-----------|\n|None| |\n\n### Headers\n\nThe 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](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/c_RESTAPI.md).\n\n<table class=\"rest_api_request_headers\"><thead><tr><th>\n\nHeader\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nAccept\n\n</td><td id=\"accept-entry-RESTAPI\">\n\nData format of the response body. Supported types: **application/json** or **application/xml**. Default: **application/json**\n\n</td></tr></tbody>\n</table>|Header|Description|\n|------|-----------|\n|None| |\n\n### Status codes\n\nThe 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](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/c_RESTAPI.md).\n\n|Status code|Description|\n|-----------|-----------|\n|200|Successful. The request was successfully processed.|\n|401|Unauthorized. The user credentials are incorrect or have not been passed.|\n|500|Internal server error. An unexpected error occurred while processing the request.|\n\n### Response body parameters \\(JSON or XML\\)\n\n<table><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\narticles\n\n</td><td>\n\nList of articles returned in response.Data type: Array\n\n ```\n[\n  {\n    \"fields\": {Object},\n    \"id\": \"String\",\n    \"link\": \"String\",\n    \"number\": \"String\",\n    \"rank\": Number,\n    \"score\": Float,\n    \"snippet\": \"String\",\n    \"title\": \"String\"\n  }\n]\n```\n\n</td></tr><tr><td>\n\narticles.fields\n\n</td><td id=\"km-resp-fields\">\n\nValues of requested fields \\(if any\\).Data type: Object\n\n ```\n\"fields\": {\n  \"<field_name>\": {Object}\n}\n```\n\n</td></tr><tr><td>\n\narticles.fields.&lt;field\\_name&gt;\n\n</td><td id=\"km-resp-fields_fieldname\">\n\nLists each field requested using the fields parameter, if any.Data type: Object\n\n ```\n\"<field_name>\": {\n  \"display_value\": \"String\",\n  \"label\": \"String\",\n  \"name\": \"String\",\n  \"type\": \"String\",\n  \"value\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\narticles.fields.&lt;field\\_name&gt;.display\\_value\n\n</td><td id=\"km-resp-fieldName-display\">\n\nDisplay value of the requested field.Data type: String\n\n</td></tr><tr><td>\n\narticles.fields.&lt;field\\_name&gt;.label\n\n</td><td id=\"km-resp-fieldName-label\">\n\nLabel representing the requested field. For example, `Knowledge`.Data type: String\n\n</td></tr><tr><td>\n\narticles.fields.&lt;field\\_name&gt;.name\n\n</td><td id=\"km-resp-fieldName-name\">\n\nName of the requested field. Matches &lt;field\\_name&gt;.Data type: String\n\n</td></tr><tr><td>\n\narticles.fields.&lt;field\\_name&gt;.type\n\n</td><td id=\"km-resp-fieldName-type\">\n\nData type of requested field.Data type: String\n\n</td></tr><tr><td>\n\narticles.fields.&lt;field\\_name&gt;.value\n\n</td><td id=\"km-resp-fields-fieldName-val\">\n\nValue of the requested field.Data type: String\n\n</td></tr><tr><td>\n\narticles.id\n\n</td><td id=\"km_kb_id\">\n\nKnowledge article sys\\_id from the Knowledge \\[kb\\_knowledge\\] table.Data type: String\n\n</td></tr><tr><td>\n\narticles.link\n\n</td><td>\n\nLink to the article.Data type: String\n\n</td></tr><tr><td>\n\narticles.number\n\n</td><td>\n\nKnowledge article number.Data type: String\n\n</td></tr><tr><td>\n\narticles.rank\n\n</td><td>\n\nSearch rank of article specific to this search.Data type: Float\n\n</td></tr><tr><td>\n\narticles.score\n\n</td><td>\n\nRelevancy score, results sorted in descending order by score.Data type: String\n\n</td></tr><tr><td>\n\narticles.snippet\n\n</td><td>\n\nText showing a small portion of the knowledge article.Data type: String\n\n</td></tr><tr><td>\n\narticles.title\n\n</td><td id=\"km_kb_sdesc\">\n\nShort description or title of the knowledge article.Data type: String\n\n</td></tr><tr><td>\n\nmeta\n\n</td><td>\n\nMeta information of the results and request parameters.Data type: Object\n\n ```\n\"meta\": {\n  \"count\": Number,\n  \"end\": Number,\n  \"fields\": \"String\",\n  \"filter\": \"String\",\n  \"kb\": \"String\",\n  \"language\": \"String\",\n  \"query\": \"String\",\n  \"start\": Number,\n  \"status\": {Object},\n  \"ts_query_id\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\nmeta.count\n\n</td><td>\n\nNumber of available KB articles.Data type: Number\n\n</td></tr><tr><td>\n\nmeta.end\n\n</td><td>\n\nEnding index of the result set.Data type: Number\n\n</td></tr><tr><td>\n\nmeta.fields\n\n</td><td>\n\nFields in the article.Data type: String\n\n</td></tr><tr><td>\n\nmeta.filter\n\n</td><td>\n\nFilter used to acquire the data.Data type: String\n\n</td></tr><tr><td>\n\nmeta.kb\n\n</td><td>\n\nList of knowledge base article sys\\_ids.Data type: String\n\n</td></tr><tr><td>\n\nmeta.language\n\n</td><td>\n\nList of comma-separated languages of the KB articles that were requested.Data type: String\n\n</td></tr><tr><td>\n\nmeta.query\n\n</td><td>\n\nSpecified request query.Data type: String\n\n</td></tr><tr><td>\n\nmeta.start\n\n</td><td>\n\nStarting index of result set.Data type: Number\n\n</td></tr><tr><td>\n\nmeta.status\n\n</td><td>\n\nHTTP status of the call.Data type: String\n\n</td></tr><tr><td>\n\nmeta.ts\\_query\\_id\n\n</td><td>\n\nSys\\_id of the query.Data type: String\n\n</td></tr></tbody>\n</table>### cURL request\n\n```\ncurl \"https://instance.servicenow.com/api/sn_km_api/knowledge/articles/most_viewed?limit=5\" \\\n--request GET \\\n--header \"Accept:application/json\" \\\n--user \"username\":\"password\"\n```\n\n```\n{\n  \"result\": {\n    \"meta\": {\n      \"start\": 0,\n      \"end\": 5,\n      \"fields\": \"\",\n      \"query\": \"\",\n      \"filter\": \"workflow_state=published^valid_to>=javascript:gs.beginningOfToday()^active=true^sys_class_name!=kb_knowledge_block^sys_view_count>0^ORDERBYDESCsys_view_count^ORDERBYshort_description\",\n      \"kb\": \"\",\n      \"count\": 2,\n      \"status\": {\n        \"code\": 200\n      },\n      \"language\": \"en\"\n    },\n    \"articles\": [\n      {\n        \"link\": \"?id=kb_article_view&sys_kb_id=0b48fd75474321009db4b5b08b9a71c2\",\n        \"id\": \"kb_knowledge:0b48fd75474321009db4b5b08b9a71c2\",\n        \"title\": \"How to Deal with Spam\",\n        \"snippet\": \"How to Deal with Spam Spam has increasingly become a problem on the Internet. While every Internet user receives some spam, email addresses posted to web sites or in newsgroups and chat rooms attract the most spam. To reduce the amount of spam you receive: Don't reply to spam Be careful releasing your email address, and know how it will be used \",\n        \"score\": 7,\n        \"tags\": [],\n        \"number\": \"KB0000011\"\n      },\n      {\n        \"link\": \"?id=kb_article_view&sys_kb_id=c85cd2519f77230088aebde8132e70c2\",\n        \"id\": \"kb_knowledge:c85cd2519f77230088aebde8132e70c2\",\n        \"title\": \"Microsoft Outlook Issues\",\n        \"snippet\": \"Microsoft Outlook Issues This article explains how to use automatic replies in Outlook 2010 for Exchange accounts. Setting Up Automatic Replies Click the File tab. Click Automatic Replies. Select Send automatic replies. If desired, select the Only send during this time range check box to schedule when your out of office replies are active. If yo\",\n        \"score\": 6,\n        \"tags\": [],\n        \"number\": \"KB99999999\"\n      }\n    ]\n  }\n}\n```\n\n"}}