{"id":23652,"date":"2020-07-03T15:22:18","date_gmt":"2020-07-03T14:22:18","guid":{"rendered":"https:\/\/developer.kore.ai\/v8-0\/?p=23652"},"modified":"2021-03-25T12:35:45","modified_gmt":"2021-03-25T12:35:45","slug":"query-data-table-api","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v8-0\/docs\/bots\/api-guide\/query-data-table-api\/","title":{"rendered":"Query Data (Table) API"},"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>Used to get data from Data Table.<\/p>\n<p class=\"note\">To use this API, the app needs to be given Read access to the Data Table from the Data Definition in DaaS (<a href=\"\/docs\/bots\/advanced-topics\/data-as-a-service\/#Assignments\" target=\"_blank\" rel=\"noopener noreferrer\">see here for details<\/a>)<\/p>\n<p><b>POST<\/b> <span style=\"font-weight: 400\"><code>https:\/\/{{host}}\/api\/public\/tables\/{{tableName}}\/query?sys_limit={{limit_value}}&amp;sys_offset={{offset_value}}<\/code><\/span><\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"Query_Parameters\">Query Parameters<\/span><\/h3>\n<table>\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400\">host<\/span><\/td>\n<td><span style=\"font-weight: 400\"><span style=\"font-weight: 400\">Environment URL, for example, <code>https:\/\/bots.kore.ai<\/code><\/span><br \/>\n<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">tableName<\/span><\/td>\n<td><span style=\"font-weight: 400\">Name of the Table to fetch data<\/span><\/td>\n<\/tr>\n<tr>\n<td>sys_limit<\/td>\n<td><span style=\"font-weight: 400\">The maximum number of records to be fetched.<br \/>\nBy default this is set to 10 and the maximum allowed is 100.<\/span><\/td>\n<\/tr>\n<tr>\n<td>sys_offset<\/td>\n<td><span style=\"font-weight: 400\">The number of records to be skipped from the beginning of the results dataset.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"Body_Parameters\">Body Parameters<\/span><\/h3>\n<table>\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>query<\/td>\n<td>Filter criteria identifying the rows to be fetched<\/p>\n<pre>\u00a0\"query\":{\r\n\t\"expressions\": [\r\n\t   {\"field\": \"&lt;col1_name&gt;\", \"operand\": \"=\/!=\/&lt;\/&gt;\", \"value\": \"&lt;value1&gt;\"},\r\n\t   {\"field\": \"&lt;col2_name&gt;\", \"operand\": \"=\/!=\/&lt;\/&gt;\", \"value\": \"&lt;value2&gt;\"}\r\n\t],\r\n\t\"operator\": \"and\/or\"\r\n\t   }<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"Authorization\">Authorization<\/span><\/h3>\n<p>Invoke the API with JWT in the header with the following syntax:<\/p>\n<p><code>auth: {{JWT}}<\/code><\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"Response_content_type\">Response content type<\/span><\/h3>\n<p><code>application\/json<\/code><\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"Sample_Request\">Sample Request<\/span><\/h3>\n<pre>curl -X POST \\\r\n  http:\/\/{{host}}\/api\/public\/tables\/{{tableName}}\/query?sys_limit=4&amp;sys_offset=0 \\\r\n  -H 'auth: {{<em>YOUR_JWT_ACCESS_TOKEN}}<\/em>' \\\r\n  -H 'content-type: application\/json' \\\r\n  -d '{\r\n      \"query\":{\r\n \t\"expressions\": [\r\n        \t{\"field\": \"firstName\", \"operand\": \"=\", \"value\": \"Jane\"},\r\n\t\t{\"field\": \"lastName\", \"operand\": \"=\", \"value\": \"Doe\"}\r\n\t\t],\r\n\t\t\"operator\": \"or\"\r\n\t   }\r\n}'<\/pre>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"Sample_Response\">Sample Response<\/span><\/h3>\n<pre>{\r\n    \"metaInfo\": [\r\n        {\r\n            \"name\": \"gender\",\r\n            \"type\": \"string\"\r\n        },\r\n        {\r\n            \"name\": \"lastName\",\r\n            \"type\": \"string\"\r\n        }\r\n    ],\r\n    \"queryResult\": [\r\n        {\r\n            \"age\": male,\r\n            \"last_name\":tony,\r\n        }\r\n    ]\r\n}\r\n<\/pre>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div><\/div><\/div><\/div><\/div><\/div><\/section>\n","protected":false},"excerpt":{"rendered":"Used to get data from Data Table. To use this API, the app needs to be given Read access to the Data Table from the Data Definition in DaaS (see here for details) POST https:\/\/{{host}}\/api\/public\/tables\/{{tableName}}\/query?sys_limit={{limit_value}}&amp;sys_offset={{offset_value}} Query Parameters Parameter Description host Environment URL, for example, https:\/\/bots.kore.ai tableName Name of the Table to fetch data sys_limit The...","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-23652","post","type-post","status-publish","format-standard","hentry","category-api-guide"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/posts\/23652","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/comments?post=23652"}],"version-history":[{"count":3,"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/posts\/23652\/revisions"}],"predecessor-version":[{"id":24610,"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/posts\/23652\/revisions\/24610"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/media?parent=23652"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/categories?post=23652"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/tags?post=23652"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}