{"id":22977,"date":"2019-12-10T10:01:52","date_gmt":"2019-12-10T10:01:52","guid":{"rendered":"https:\/\/developer.kore.ai\/v10-1\/?p=22977"},"modified":"2024-03-06T06:58:03","modified_gmt":"2024-03-06T06:58:03","slug":"get-widget","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/api-guide\/get-widget\/","title":{"rendered":"Get Dashboard Widget Data"},"content":{"rendered":"<section class=\"l-section wpb_row height_auto\"><div class=\"l-section-h i-cf\"><div class=\"g-cols vc_row type_default valign_top\"><div class=\"vc_col-sm-12 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\">\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<p>To retrieve the data associated with custom widgets and the reports of a bot.<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>Method<\/strong><\/td>\n<td>GET<\/td>\n<\/tr>\n<tr>\n<td><strong>Endpoint<\/strong><\/td>\n<td><code>https:\/\/{{host}}\/api\/public\/bot\/{{BotID}}\/dashboard\/<br \/>\n{{dashboardName}}\/widget\/{{widgetName}}?startDate={{startDate}}&amp;endDate={{endDate}}&amp;limit=-1<\/code><\/p>\n<p><strong>Note:<\/strong> A POST API call is now supported to include the additional filters for querying the data. See <a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/analyzing-your-bot\/create-custom-dashboard-filters\/\" target=\"_blank\" rel=\"noopener noreferrer\">Custom Dashboard Filters<\/a> to know more about additional filters.<\/td>\n<\/tr>\n<tr>\n<td><strong>Content Type<\/strong><\/td>\n<td><code>application\/json<\/code><\/td>\n<\/tr>\n<tr>\n<td><strong>Authorization<\/strong><\/td>\n<td><code>auth: {{JWT}}<\/code><\/p>\n<p>See <a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/api-guide\/apis\/#Generating_the_JWT_Token\" target=\"_blank\" rel=\"noopener noreferrer\">How to generate the JWT Token.<\/a><\/td>\n<\/tr>\n<tr>\n<td><strong>API Scope<\/strong><\/td>\n<td>\n<ul>\n<li>Bot Builder: Custom Reports<\/li>\n<li>Admin Console: Custom Reports &gt; Custom Reports<\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h2><span class=\"ez-toc-section\" id=\"Path_Parameters\">Path Parameters<\/span><\/h2>\n<table>\n<tbody>\n<tr>\n<th><b>Parameter<\/b><\/th>\n<th><b>Required\/Optional<\/b><\/th>\n<th><b>Description<\/b><\/th>\n<\/tr>\n<tr>\n<td>host<\/td>\n<td>Required<\/td>\n<td>Environment URL, for example, https:\/\/bots.kore.ai<\/td>\n<\/tr>\n<tr>\n<td>BotID<\/td>\n<td>Required<\/td>\n<td>Bot ID or Stream ID. You can access it from the General Settings page of the bot.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Sample_Request_for_GET_call\">Sample Request for GET call<\/span><\/h2>\n<pre>curl -X GET \\\r\n \"https:\/\/{{host}}\/api\/public\/bot\/{{bot_id}}\/dashboard\/{{dashboardName}}\/widget\/{{widgetName}}?startDate={{startDate}}&amp;endDate={{endDate}}\" \\\r\n  -H 'auth: {{YOUR_JWT_ACCESS_TOKEN}}' \\\r\n  -H 'content-type: application\/json' \\<\/pre>\n<p><strong>Sample Request for POST call<\/strong><\/p>\n<pre>curl --location --request POST 'https:\/\/{{host}}\/api\/public\/bot\/{{bot_id}}\/dashboard\/{{dashboardName}}\/widget\/{{widgetName}}?startDate={{startDate}}&amp;endDate={{endDate}}' \\\r\n--header 'auth: {{YOUR_JWT_ACCESS_TOKEN}}' \\ \r\n--header 'Content-Type: application\/json' \\ \r\n--data-raw \r\n'{ \"customFilters\": \r\n[ \r\n{ \"filterSource\": \"userType\", \r\n  \"fieldName\": \"user\", \r\n  \"values\": \r\n[ \"newuser\" ] \r\n}\r\n]\r\n}<\/pre>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Body_Parameters\">Body Parameters<\/span><\/h2>\n<table>\n<tbody>\n<tr>\n<th><b>Parameter<\/b><\/th>\n<th><b>Required\/Optional<\/b><\/th>\n<th><b>Description<\/b><\/th>\n<\/tr>\n<tr>\n<td>dashboardName<\/td>\n<td>Required<\/td>\n<td>Name of the Custom Dashboard containing the required Widget.<\/td>\n<\/tr>\n<tr>\n<td>widgetName<\/td>\n<td>Required<\/td>\n<td>Name of the Widget whose data needs to be retrieved.<\/td>\n<\/tr>\n<tr>\n<td>limit<\/td>\n<td>Optional<\/td>\n<td>The number of records to fetch. The maximum applicable limit is 50.<\/td>\n<\/tr>\n<tr>\n<td>startDate<\/td>\n<td>Required<\/td>\n<td>The start date from which you want to see the changes. Enter the date in ISO date format. For example,\u00a0March 30, 2020 would be 2020-03-30.<\/td>\n<\/tr>\n<tr>\n<td>endDate<\/td>\n<td>Required<\/td>\n<td>The end date up to which you want to see the changes.\u00a0Enter the date in ISO date format. For example,\u00a0March 30, 2020 would be 2020-03-30.<\/td>\n<\/tr>\n<tr>\n<td>customFilters:<\/p>\n<p>filterSource<br \/>\nfieldName<br \/>\nvalues<\/td>\n<td>Required<\/td>\n<td>To understand about the custom dashboard filters, see <a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/analyzing-your-bot\/create-custom-dashboard-filters\/\" target=\"_blank\" rel=\"noopener noreferrer\">Create Custom Dashboard Filters<\/a>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Sample_Response_for_GET_and_POST_calls\">Sample Response for GET and POST calls<\/span><\/h2>\n<pre class=\"code-limit-400px\">{\r\n    \"_id\": \"wg-xxxx-xxx-xxx-xxx-xxxxx\",\r\n    \"overlay\": [],\r\n    \"name\": \"dasaDSA\",\r\n    \"type\": \"table\",\r\n    \"sqlQuery\": {\r\n        \"dataSet\": \"Analytics\",\r\n        \"select\": \"metricType\",\r\n        \"startDate\": \"2019-08-31T18:30:00.000Z\",\r\n        \"endDate\": \"2019-10-01T18:30:00.000Z\",\r\n        \"botId\": \"st-xxxxx-xxx-xxx-xxx-xxxxx\"\r\n    },\r\n    \"dimensions\": [\r\n           {\r\n            \"fieldName\": \"metricType\",\r\n            \"displayName\": \"metricType\",\r\n            \"type\": \"string\"\r\n        }\r\n    ],\r\n    \"metrics\": [],\r\n    \"row\": [],\r\n    \"properties\": {},\r\n    \"queryResponse\": {\r\n        \"metaData\": {\r\n            \"metricType\": \"string\"\r\n        },\r\n        \"queryResponse\": [\r\n            {\r\n                \"metricType\": \"successintents\"\r\n            },\r\n            {\r\n                \"metricType\": \"successtasks\"\r\n            },\r\n            {\r\n                \"metricType\": \"successintents\"\r\n            },\r\n            {\r\n                \"metricType\": \"successintents\"\r\n            },\r\n            {\r\n                \"metricType\": \"successtasks\"\r\n            },\r\n            {\r\n                \"metricType\": \"failedintents\"\r\n            }\r\n        ]\r\n    }\r\n}\r\n<\/pre>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<\/div><\/div><\/div><\/div><\/div><\/section>\n","protected":false},"excerpt":{"rendered":"To retrieve the data associated with custom widgets and the reports of a bot. Method GET Endpoint https:\/\/{{host}}\/api\/public\/bot\/{{BotID}}\/dashboard\/ {{dashboardName}}\/widget\/{{widgetName}}?startDate={{startDate}}&amp;endDate={{endDate}}&amp;limit=-1 Note: A POST API call is now supported to include the additional filters for querying the data. See Custom Dashboard Filters to know more about additional filters. Content Type application\/json Authorization auth: {{JWT}} See How to...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-22977","post","type-post","status-publish","format-standard","hentry","category-api-guide"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/22977","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/comments?post=22977"}],"version-history":[{"count":30,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/22977\/revisions"}],"predecessor-version":[{"id":61361,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/22977\/revisions\/61361"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/media?parent=22977"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/categories?post=22977"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/tags?post=22977"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}