Guide
Smart Search
Examples
19 min
if you haven't gone through the prerequisites and the v2 structure, please have a look at overview docid\ czeodl0skcuv 18ipuplr custom record type in addition to products, categories and cms pages, klevu apiv2 allows you to search for custom entities for example, if you want to display results for recipes, articles or physical stores within your search you can do so by utilising the typeofrecords parameter { "tab" "examples", "url" "https //{{hostname}}/cs/v2/search", "name" "custom record type", "method" "post", "request" { "pathparameters" \[], "queryparameters" \[], "headerparameters" \[], "bodydataparameters" \[ { "kind" "required", "name" "typeofrecords", "type" "array", "description" "specify the identifier(s) of your custom entity types that you have indexed with klevu, for example acme recipe or acme store " } ], "formdataparameters" \[] }, "results" { "languages" \[ { "id" "3xlvmt855lgkjoht0npxg", "code" "{\n \\"meta\\" {\n \\"qtime\\" 8,\n \\"responsecode\\" 200\n },\n \\"queryresults\\" \[\n {\n \\"id\\" \\"customeentitysearch1\\",\n \\"meta\\" {\n \\"qtime\\" 5,\n \\"noofresults\\" 1,\n \\"totalresultsfound\\" 2,\n \\"typeofsearch\\" \\"wildcard and\\",\n \\"offset\\" 0,\n \\"debugginginformation\\" {},\n \\"notificationcode\\" 1,\n \\"searchedterm\\" \\"fish\\",\n \\"apikey\\" \\"klevu 156925593843210765\\",\n \\"ispersonalised\\" false\n },\n \\"records\\" \[\n {\n \\"name\\" \\"recipe fish and chips\\",\n \\"klevu category\\" \\"acme recipe @ku\@kucategory\@ku@\\",\n \\"id\\" \\"recipe 1\\",\n \\"typeofrecord\\" \\"acme recipe\\"\n }\n ],\n \\"filters\\" \[]\n },\n {\n \\"id\\" \\"customeentitysearch2\\",\n \\"meta\\" {\n \\"qtime\\" 7,\n \\"noofresults\\" 1,\n \\"totalresultsfound\\" 1,\n \\"typeofsearch\\" \\"wildcard and\\",\n \\"offset\\" 0,\n \\"debugginginformation\\" {},\n \\"notificationcode\\" 1,\n \\"searchedterm\\" \\"london\\",\n \\"apikey\\" \\"klevu 156925593843210765\\",\n \\"ispersonalised\\" false\n },\n \\"records\\" \[\n {\n \\"name\\" \\"shop london\\",\n \\"klevu category\\" \\"acme store @ku\@kucategory\@ku@\\",\n \\"id\\" \\"shop 2\\",\n \\"typeofrecord\\" \\"acme store\\"\n }\n ],\n \\"filters\\" \[]\n }\n ]\n}", "language" "200", "customlabel" "" } ], "selectedlanguageid" "3xlvmt855lgkjoht0npxg" }, "examples" { "languages" \[ { "id" "jsu7dlyyj euh63ysp682", "code" "{\n \\"recordqueries\\" \[\n {\n \\"id\\" \\"customeentitysearch1\\",\n \\"settings\\" {\n \\"query\\" {\n \\"term\\" \\"fish\\"\n },\n \\"limit\\" 1,\n \\"typeofrecords\\" \[\n \\"acme recipe\\"\n ],\n \\"fields\\" \[\n \\"id\\",\n \\"name\\",\n \\"typeofrecord\\"\n ]\n }\n },\n {\n \\"id\\" \\"customeentitysearch2\\",\n \\"settings\\" {\n \\"query\\" {\n \\"term\\" \\"london\\"\n },\n \\"limit\\" 1,\n \\"typeofrecords\\" \[\n \\"acme store\\"\n ],\n \\"fields\\" \[\n \\"id\\",\n \\"name\\",\n \\"typeofrecord\\"\n ]\n }\n }\n ],\n \\"context\\" {\n \\"apikeys\\" \[\n \\"klevu 156925593843210765\\"\n ]\n }\n}", "language" "json", "customlabel" "request body (json)" }, { "id" "8yg33te4jzfowp5yebmjh", "code" "\<?php\n\n$curl = curl init();\n\ncurl setopt array($curl, array(\n curlopt url => 'https //eucs15v2 ksearchnet com/cs/v2/search',\n curlopt returntransfer => true,\n curlopt encoding => '',\n curlopt maxredirs => 10,\n curlopt timeout => 0,\n curlopt followlocation => true,\n curlopt http version => curl http version 1 1,\n curlopt customrequest => 'post',\n curlopt postfields =>'{\n \\"recordqueries\\" \[\n {\n \\"id\\" \\"customeentitysearch1\\",\n \\"settings\\" {\n \\"query\\" {\n \\"term\\" \\"fish\\"\n },\n \\"limit\\" 1,\n \\"typeofrecords\\" \[\n \\"acme recipe\\"\n ],\n \\"fields\\" \[\n \\"id\\",\n \\"name\\",\n \\"typeofrecord\\"\n ]\n }\n },\n {\n \\"id\\" \\"customeentitysearch2\\",\n \\"settings\\" {\n \\"query\\" {\n \\"term\\" \\"london\\"\n },\n \\"limit\\" 1,\n \\"typeofrecords\\" \[\n \\"acme store\\"\n ],\n \\"fields\\" \[\n \\"id\\",\n \\"name\\",\n \\"typeofrecord\\"\n ]\n }\n }\n ],\n \\"context\\" {\n \\"apikeys\\" \[\n \\"klevu 156925593843210765\\"\n ]\n }\n}',\n curlopt httpheader => array(\n 'content type application/json'\n ),\n));\n\n$response = curl exec($curl);\n\ncurl close($curl);\necho $response;\n", "language" "php", "customlabel" "" }, { "id" "wcdgtssqaxfiwklk2v174", "code" "var data = json stringify({\\"recordqueries\\" \[{\\"id\\" \\"customeentitysearch1\\",\\"settings\\" {\\"query\\" {\\"term\\" \\"fish\\"},\\"limit\\" 1,\\"typeofrecords\\" \[\\"acme recipe\\"],\\"fields\\" \[\\"id\\",\\"name\\",\\"typeofrecord\\"]}},{\\"id\\" \\"customeentitysearch2\\",\\"settings\\" {\\"query\\" {\\"term\\" \\"london\\"},\\"limit\\" 1,\\"typeofrecords\\" \[\\"acme store\\"],\\"fields\\" \[\\"id\\",\\"name\\",\\"typeofrecord\\"]}}],\\"context\\" {\\"apikeys\\" \[\\"klevu 156925593843210765\\"]}});\n\nvar xhr = new xmlhttprequest();\nxhr withcredentials = false;\n\nxhr addeventlistener(\\"readystatechange\\", function() {\n if(this readystate === 4) {\n console log(this responsetext);\n }\n});\n\nxhr open(\\"post\\", \\"https //eucs15v2 ksearchnet com/cs/v2/search\\");\nxhr setrequestheader(\\"content type\\", \\"application/json\\");\n\nxhr send(data);", "language" "javascript", "customlabel" "" }, { "id" "npw0nije j5r9i5w4bgn0", "code" "okhttpclient client = new okhttpclient() newbuilder()\n build();\nmediatype mediatype = mediatype parse(\\"application/json\\");\nrequestbody body = requestbody create(mediatype, \\"{\\\n \\\\\\"recordqueries\\\\\\" \[\\\n {\\\n \\\\\\"id\\\\\\" \\\\\\"customeentitysearch1\\\\\\",\\\n \\\\\\"settings\\\\\\" {\\\n \\\\\\"query\\\\\\" {\\\n \\\\\\"term\\\\\\" \\\\\\"fish\\\\\\"\\\n },\\\n \\\\\\"limit\\\\\\" 1,\\\n \\\\\\"typeofrecords\\\\\\" \[\\\n \\\\\\"acme recipe\\\\\\"\\\n ],\\\n \\\\\\"fields\\\\\\" \[\\\n \\\\\\"id\\\\\\",\\\n \\\\\\"name\\\\\\",\\\n \\\\\\"typeofrecord\\\\\\"\\\n ]\\\n }\\\n },\\\n {\\\n \\\\\\"id\\\\\\" \\\\\\"customeentitysearch2\\\\\\",\\\n \\\\\\"settings\\\\\\" {\\\n \\\\\\"query\\\\\\" {\\\n \\\\\\"term\\\\\\" \\\\\\"london\\\\\\"\\\n },\\\n \\\\\\"limit\\\\\\" 1,\\\n \\\\\\"typeofrecords\\\\\\" \[\\\n \\\\\\"acme store\\\\\\"\\\n ],\\\n \\\\\\"fields\\\\\\" \[\\\n \\\\\\"id\\\\\\",\\\n \\\\\\"name\\\\\\",\\\n \\\\\\"typeofrecord\\\\\\"\\\n ]\\\n }\\\n }\\\n ],\\\n \\\\\\"context\\\\\\" {\\\n \\\\\\"apikeys\\\\\\" \[\\\n \\\\\\"klevu 156925593843210765\\\\\\"\\\n ]\\\n }\\\n}\\");\nrequest request = new request builder()\n url(\\"https //eucs15v2 ksearchnet com/cs/v2/search\\")\n method(\\"post\\", body)\n addheader(\\"content type\\", \\"application/json\\")\n build();\nresponse response = client newcall(request) execute();", "language" "java", "customlabel" "" }, { "id" "0ih7niekhhfml7cry51j ", "code" "var request = require('request');\nvar options = {\n 'method' 'post',\n 'url' 'https //eucs15v2 ksearchnet com/cs/v2/search',\n 'headers' {\n 'content type' 'application/json'\n },\n body json stringify({\\"recordqueries\\" \[{\\"id\\" \\"customeentitysearch1\\",\\"settings\\" {\\"query\\" {\\"term\\" \\"fish\\"},\\"limit\\" 1,\\"typeofrecords\\" \[\\"acme recipe\\"],\\"fields\\" \[\\"id\\",\\"name\\",\\"typeofrecord\\"]}},{\\"id\\" \\"customeentitysearch2\\",\\"settings\\" {\\"query\\" {\\"term\\" \\"london\\"},\\"limit\\" 1,\\"typeofrecords\\" \[\\"acme store\\"],\\"fields\\" \[\\"id\\",\\"name\\",\\"typeofrecord\\"]}}],\\"context\\" {\\"apikeys\\" \[\\"klevu 156925593843210765\\"]}})\n\n};\nrequest(options, function (error, response) {\n if (error) throw new error(error);\n console log(response body);\n});\n", "language" "nodejs", "customlabel" "" } ], "selectedlanguageid" "wcdgtssqaxfiwklk2v174" }, "description" "this is an example how to search for custom record type ", "currentnewparameter" { "label" "body parameter", "value" "bodydataparameters" } } try it here multiple queries klevu apiv2 allows you to request multiple product, category, cms pages and custom entity queries all at the same time all of these queries are usually fired simultaneously, meaning the total time taken is the duration of the slowest query, rather than the total of all queries in the example to the right, a single http request is returning 3x search suggestions 3x categories 5x products with filters 3x different products without filters 5x cms pages or recipes (a custom entity) 1x store (a custom entity) furthermore, all of the configuration and preferences found within this documentation can be applied to each and evey query separately, making an extremely powerful and fast way to display search results { "tab" "examples", "url" "https //{{hostname}}/cs/v2/search", "name" "multiple queries", "method" "post", "request" { "pathparameters" \[], "queryparameters" \[], "headerparameters" \[], "bodydataparameters" \[], "formdataparameters" \[] }, "results" { "languages" \[ { "id" "3xlvmt855lgkjoht0npxg", "code" "{\n \\"meta\\" {\n \\"qtime\\" 21,\n \\"responsecode\\" 200\n },\n \\"suggestionresults\\" \[\n {\n \\"id\\" \\"suggestionsearch\\",\n \\"suggestions\\" \[\n {\n \\"suggest\\" \\"\<b>a\</b>tomic\\"\n },\n {\n \\"suggest\\" \\"\<b>a\</b>tomic endurance\\"\n },\n {\n \\"suggest\\" \\"\<b>a\</b>tomic endurance running\\"\n }\n ]\n }\n ],\n \\"queryresults\\" \[\n {\n \\"id\\" \\"categorysearch\\",\n \\"meta\\" {\n \\"qtime\\" 8,\n \\"noofresults\\" 3,\n \\"totalresultsfound\\" 1,\n \\"typeofsearch\\" \\"wildcard and\\",\n \\"offset\\" 0,\n \\"debugginginformation\\" {},\n \\"notificationcode\\" 1,\n \\"searchedterm\\" \\"a\\",\n \\"apikey\\" \\"klevu 156925593843210765\\",\n \\"ispersonalised\\" false\n },\n \\"records\\" \[\n {\n \\"name\\" \\"accessories\\",\n \\"id\\" \\"category 156704342078\\"\n }\n ],\n \\"filters\\" \[]\n },\n {\n \\"id\\" \\"productsearch1\\",\n \\"meta\\" {\n \\"qtime\\" 14,\n \\"noofresults\\" 5,\n \\"totalresultsfound\\" 447,\n \\"typeofsearch\\" \\"wildcard and\\",\n \\"offset\\" 0,\n \\"debugginginformation\\" {},\n \\"notificationcode\\" 1,\n \\"searchedterm\\" \\"a\\",\n \\"apikey\\" \\"klevu 156925593843210765\\",\n \\"ispersonalised\\" false\n },\n \\"records\\" \[\n {\n \\"name\\" \\"affirm water bottle\\",\n \\"id\\" \\"31366498222142\\"\n },\n {\n \\"name\\" \\"cruise dual analog watch\\",\n \\"id\\" \\"31366496124990\\"\n },\n {\n \\"name\\" \\"ariel roll sleeve sweatshirt\\",\n \\"id\\" \\"31366458376254\\"\n },\n {\n \\"name\\" \\"livingston all purpose tight\\",\n \\"id\\" \\"31366468010046\\"\n },\n {\n \\"name\\" \\"livingston all purpose tight\\",\n \\"id\\" \\"31366467977278\\"\n }\n ],\n \\"filters\\" \[\n {\n \\"key\\" \\"tags\\",\n \\"label\\" \\"tags\\",\n \\"type\\" \\"options\\",\n \\"options\\" \[\n {\n \\"count\\" 192,\n \\"name\\" \\"machine\\",\n \\"value\\" \\"machine\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 143,\n \\"name\\" \\"comfortable\\",\n \\"value\\" \\"comfortable\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 120,\n \\"name\\" \\"comfort\\",\n \\"value\\" \\"comfort\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 116,\n \\"name\\" \\"winter\\",\n \\"value\\" \\"winter\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 106,\n \\"name\\" \\"cotton\\",\n \\"value\\" \\"cotton\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 80,\n \\"name\\" \\"hoodie\\",\n \\"value\\" \\"hoodie\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 77,\n \\"name\\" \\"flexible\\",\n \\"value\\" \\"flexible\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 76,\n \\"name\\" \\"cold whether\\",\n \\"value\\" \\"cold whether\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 67,\n \\"name\\" \\"short\\",\n \\"value\\" \\"short\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 62,\n \\"name\\" \\"royal\\",\n \\"value\\" \\"royal\\",\n \\"selected\\" false\n }\n ]\n },\n {\n \\"key\\" \\"category\\",\n \\"label\\" \\"category\\",\n \\"type\\" \\"options\\",\n \\"options\\" \[\n {\n \\"count\\" 83,\n \\"name\\" \\"hoodies & sweatshirts\\",\n \\"value\\" \\"hoodies & sweatshirts\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 81,\n \\"name\\" \\"jackets\\",\n \\"value\\" \\"jackets\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 77,\n \\"name\\" \\"pants\\",\n \\"value\\" \\"pants\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 71,\n \\"name\\" \\"smart collection 1\\",\n \\"value\\" \\"smart collection 1\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 69,\n \\"name\\" \\"tees\\",\n \\"value\\" \\"tees\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 68,\n \\"name\\" \\"shorts\\",\n \\"value\\" \\"shorts\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 59,\n \\"name\\" \\"smart collection 3\\",\n \\"value\\" \\"smart collection 3\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 53,\n \\"name\\" \\"hoodies\\",\n \\"value\\" \\"hoodies\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 42,\n \\"name\\" \\"bras & tanks\\",\n \\"value\\" \\"bras & tanks\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 39,\n \\"name\\" \\"tanks\\",\n \\"value\\" \\"tanks\\",\n \\"selected\\" false\n }\n ]\n },\n {\n \\"key\\" \\"size\\",\n \\"label\\" \\"size\\",\n \\"type\\" \\"options\\",\n \\"options\\" \[\n {\n \\"count\\" 143,\n \\"name\\" \\"small\\",\n \\"value\\" \\"small\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 141,\n \\"name\\" \\"medium\\",\n \\"value\\" \\"medium\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 140,\n \\"name\\" \\"large\\",\n \\"value\\" \\"large\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 9,\n \\"name\\" \\"free size\\",\n \\"value\\" \\"free size\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 3,\n \\"name\\" \\"s\\",\n \\"value\\" \\"s\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 2,\n \\"name\\" \\"xl\\",\n \\"value\\" \\"xl\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 2,\n \\"name\\" \\"xxl\\",\n \\"value\\" \\"xxl\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 2,\n \\"name\\" \\"medium\\",\n \\"value\\" \\"medium\\",\n \\"selected\\" false\n }\n ]\n },\n {\n \\"key\\" \\"brand\\",\n \\"label\\" \\"brand\\",\n \\"type\\" \\"options\\",\n \\"options\\" \[\n {\n \\"count\\" 169,\n \\"name\\" \\"ksd\\",\n \\"value\\" \\"ksd\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 144,\n \\"name\\" \\"mnh\\",\n \\"value\\" \\"mnh\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 138,\n \\"name\\" \\"kke\\",\n \\"value\\" \\"kke\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 7,\n \\"name\\" \\"klevu search demo\\",\n \\"value\\" \\"klevu search demo\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 1,\n \\"name\\" \\"kke new\\",\n \\"value\\" \\"kke new\\",\n \\"selected\\" false\n }\n ]\n },\n {\n \\"key\\" \\"type\\",\n \\"label\\" \\"type\\",\n \\"type\\" \\"options\\",\n \\"options\\" \[\n {\n \\"count\\" 83,\n \\"name\\" \\"hoodies & sweatshirts\\",\n \\"value\\" \\"hoodies & sweatshirts\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 77,\n \\"name\\" \\"pants\\",\n \\"value\\" \\"pants\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 69,\n \\"name\\" \\"tees\\",\n \\"value\\" \\"tees\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 68,\n \\"name\\" \\"shorts\\",\n \\"value\\" \\"shorts\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 62,\n \\"name\\" \\"jackets\\",\n \\"value\\" \\"jackets\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 42,\n \\"name\\" \\"bras & tanks\\",\n \\"value\\" \\"bras & tanks\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 18,\n \\"name\\" \\"tanks\\",\n \\"value\\" \\"tanks\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 14,\n \\"name\\" \\"bags\\",\n \\"value\\" \\"bags\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 10,\n \\"name\\" \\"fitness equipment\\",\n \\"value\\" \\"fitness equipment\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 9,\n \\"name\\" \\"watches\\",\n \\"value\\" \\"watches\\",\n \\"selected\\" false\n }\n ]\n },\n {\n \\"key\\" \\"saleprice\\",\n \\"label\\" \\"saleprice\\",\n \\"type\\" \\"options\\",\n \\"options\\" \[\n {\n \\"count\\" 47,\n \\"name\\" \\"29 00\\",\n \\"value\\" \\"29 00\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 35,\n \\"name\\" \\"39 00\\",\n \\"value\\" \\"39 00\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 26,\n \\"name\\" \\"32 00\\",\n \\"value\\" \\"32 00\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 24,\n \\"name\\" \\"42 00\\",\n \\"value\\" \\"42 00\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 22,\n \\"name\\" \\"24 00\\",\n \\"value\\" \\"24 00\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 22,\n \\"name\\" \\"28 00\\",\n \\"value\\" \\"28 00\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 20,\n \\"name\\" \\"48 00\\",\n \\"value\\" \\"48 00\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 17,\n \\"name\\" \\"45 00\\",\n \\"value\\" \\"45 00\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 16,\n \\"name\\" \\"57 00\\",\n \\"value\\" \\"57 00\\",\n \\"selected\\" false\n },\n {\n \\"count\\" 14,\n \\"name\\" \\"49 00\\",\n \\"value\\" \\"49 00\\",\n \\"selected\\" false\n }\n ]\n }\n ]\n },\n {\n \\"id\\" \\"productsearch2\\",\n \\"meta\\" {\n \\"qtime\\" 10,\n \\"noofresults\\" 3,\n \\"totalresultsfound\\" 419,\n \\"typeofsearch\\" \\"wildcard and\\",\n \\"offset\\" 0,\n \\"debugginginformation\\" {},\n \\"notificationcode\\" 1,\n \\"searchedterm\\" \\"b\\",\n \\"apikey\\" \\"klevu 156925593843210765\\",\n \\"ispersonalised\\" false\n },\n \\"records\\" \[\n {\n \\"name\\" \\"wayfarer messenger bag\\",\n \\"id\\" \\"31366499991614\\"\n },\n {\n \\"name\\" \\"prima compete bra top\\",\n \\"id\\" \\"31366445826110\\"\n },\n {\n \\"name\\" \\"lucia cross fit bra\\",\n \\"id\\" \\"31366444220478\\"\n }\n ],\n \\"filters\\" \[]\n },\n {\n \\"id\\" \\"cmsandrecipesearch\\",\n \\"meta\\" {\n \\"qtime\\" 10,\n \\"noofresults\\" 5,\n \\"totalresultsfound\\" 7,\n \\"typeofsearch\\" \\"wildcard and\\",\n \\"offset\\" 0,\n \\"debugginginformation\\" {},\n \\"notificationcode\\" 1,\n \\"searchedterm\\" \\"a\\",\n \\"apikey\\" \\"klevu 156925593843210765\\",\n \\"ispersonalised\\" false\n },\n \\"records\\" \[\n {\n \\"name\\" \\"recipe fish and chips\\",\n \\"id\\" \\"recipe 1\\"\n },\n {\n \\"name\\" \\"about us\\",\n \\"id\\" \\"page 47677767742\\"\n },\n {\n \\"name\\" \\"recipe fish & chips\\",\n \\"id\\" \\"page 50756288574\\"\n },\n {\n \\"name\\" \\"recipe fish pie\\",\n \\"id\\" \\"page 51008929854\\"\n },\n {\n \\"name\\" \\"recipe fish pie\\",\n \\"id\\" \\"recipe 2\\"\n }\n ],\n \\"filters\\" \[]\n },\n {\n \\"id\\" \\"storesearch\\",\n \\"meta\\" {\n \\"qtime\\" 10,\n \\"noofresults\\" 1,\n \\"totalresultsfound\\" 2,\n \\"typeofsearch\\" \\"wildcard and\\",\n \\"offset\\" 0,\n \\"debugginginformation\\" {},\n \\"notificationcode\\" 1,\n \\"searchedterm\\" \\"a\\",\n \\"apikey\\" \\"klevu 156925593843210765\\",\n \\"ispersonalised\\" false\n },\n \\"records\\" \[\n {\n \\"name\\" \\"shop london\\",\n \\"id\\" \\"shop 2\\"\n }\n ],\n \\"filters\\" \[]\n }\n ]\n}", "language" "200", "customlabel" "" } ], "selectedlanguageid" "3xlvmt855lgkjoht0npxg" }, "examples" { "languages" \[ { "id" "jsu7dlyyj euh63ysp682", "code" "{\n \\"context\\" {\n \\"apikeys\\" \[\n \\"klevu 156925593843210765\\"\n ]\n },\n \\"suggestions\\" \[\n {\n \\"id\\" \\"suggestionsearch\\",\n \\"typeofquery\\" \\"auto suggestions\\",\n \\"query\\" \\"a\\",\n \\"limit\\" 3\n }\n ],\n \\"recordqueries\\" \[\n {\n \\"id\\" \\"categorysearch\\",\n \\"settings\\" {\n \\"query\\" {\n \\"term\\" \\"a\\"\n },\n \\"limit\\" 3,\n \\"typeofrecords\\" \[\n \\"klevu category\\"\n ],\n \\"fields\\" \[\n \\"id\\",\n \\"name\\"\n ]\n }\n },\n {\n \\"id\\" \\"productsearch1\\",\n \\"settings\\" {\n \\"query\\" {\n \\"term\\" \\"a\\"\n },\n \\"limit\\" 5,\n \\"typeofrecords\\" \[\n \\"klevu product\\"\n ],\n \\"fields\\" \[\n \\"id\\",\n \\"name\\"\n ]\n },\n \\"filters\\" {\n \\"filterstoreturn\\" {\n \\"enabled\\" true\n }\n }\n },\n {\n \\"id\\" \\"productsearch2\\",\n \\"settings\\" {\n \\"query\\" {\n \\"term\\" \\"b\\"\n },\n \\"limit\\" 3,\n \\"typeofrecords\\" \[\n \\"klevu product\\"\n ],\n \\"fields\\" \[\n \\"id\\",\n \\"name\\"\n ]\n }\n },\n {\n \\"id\\" \\"cmsandrecipesearch\\",\n \\"settings\\" {\n \\"query\\" {\n \\"term\\" \\"a\\"\n },\n \\"limit\\" 5,\n \\"typeofrecords\\" \[\n \\"klevu cms\\",\n \\"acme recipe\\"\n ],\n \\"fields\\" \[\n \\"id\\",\n \\"name\\"\n ]\n }\n },\n {\n \\"id\\" \\"storesearch\\",\n \\"settings\\" {\n \\"query\\" {\n \\"term\\" \\"a\\"\n },\n \\"limit\\" 1,\n \\"typeofrecords\\" \[\n \\"acme store\\"\n ],\n \\"fields\\" \[\n \\"id\\",\n \\"name\\"\n ]\n }\n }\n ]\n}\n", "language" "json", "customlabel" "request body (json)" }, { "id" "8yg33te4jzfowp5yebmjh", "code" "\<?php\n\n$curl = curl init();\n\ncurl setopt array($curl, array(\n curlopt url => 'https //eucs15v2 ksearchnet com/cs/v2/search',\n curlopt returntransfer => true,\n curlopt encoding => '',\n curlopt maxredirs => 10,\n curlopt timeout => 0,\n curlopt followlocation => true,\n curlopt http version => curl http version 1 1,\n curlopt customrequest => 'post',\n curlopt postfields =>'{\n \\"context\\" {\n \\"apikeys\\" \[\n \\"klevu 156925593843210765\\"\n ]\n },\n \\"suggestions\\" \[\n {\n \\"id\\" \\"suggestionsearch\\",\n \\"typeofquery\\" \\"auto suggestions\\",\n \\"query\\" \\"a\\",\n \\"limit\\" 3\n }\n ],\n \\"recordqueries\\" \[\n {\n \\"id\\" \\"categorysearch\\",\n \\"settings\\" {\n \\"query\\" {\n \\"term\\" \\"a\\"\n },\n \\"limit\\" 3,\n \\"typeofrecords\\" \[\n \\"klevu category\\"\n ],\n \\"fields\\" \[\n \\"id\\",\n \\"name\\"\n ]\n }\n },\n {\n \\"id\\" \\"productsearch1\\",\n \\"settings\\" {\n \\"query\\" {\n \\"term\\" \\"a\\"\n },\n \\"limit\\" 5,\n \\"typeofrecords\\" \[\n \\"klevu product\\"\n ],\n \\"fields\\" \[\n \\"id\\",\n \\"name\\"\n ]\n },\n \\"filters\\" {\n \\"filterstoreturn\\" {\n \\"enabled\\" true\n }\n }\n },\n {\n \\"id\\" \\"productsearch2\\",\n \\"settings\\" {\n \\"query\\" {\n \\"term\\" \\"b\\"\n },\n \\"limit\\" 3,\n \\"typeofrecords\\" \[\n \\"klevu product\\"\n ],\n \\"fields\\" \[\n \\"id\\",\n \\"name\\"\n ]\n }\n },\n {\n \\"id\\" \\"cmsandrecipesearch\\",\n \\"settings\\" {\n \\"query\\" {\n \\"term\\" \\"a\\"\n },\n \\"limit\\" 5,\n \\"typeofrecords\\" \[\n \\"klevu cms\\",\n \\"acme recipe\\"\n ],\n \\"fields\\" \[\n \\"id\\",\n \\"name\\"\n ]\n }\n },\n {\n \\"id\\" \\"storesearch\\",\n \\"settings\\" {\n \\"query\\" {\n \\"term\\" \\"a\\"\n },\n \\"limit\\" 1,\n \\"typeofrecords\\" \[\n \\"acme store\\"\n ],\n \\"fields\\" \[\n \\"id\\",\n \\"name\\"\n ]\n }\n }\n ]\n}\n',\n curlopt httpheader => array(\n 'content type application/json'\n ),\n));\n\n$response = curl exec($curl);\n\ncurl close($curl);\necho $response;\n", "language" "php", "customlabel" "" }, { "id" "wcdgtssqaxfiwklk2v174", "code" "var data = json stringify({\\"context\\" {\\"apikeys\\" \[\\"klevu 156925593843210765\\"]},\\"suggestions\\" \[{\\"id\\" \\"suggestionsearch\\",\\"typeofquery\\" \\"auto suggestions\\",\\"query\\" \\"a\\",\\"limit\\" 3}],\\"recordqueries\\" \[{\\"id\\" \\"categorysearch\\",\\"settings\\" {\\"query\\" {\\"term\\" \\"a\\"},\\"limit\\" 3,\\"typeofrecords\\" \[\\"klevu category\\"],\\"fields\\" \[\\"id\\",\\"name\\"]}},{\\"id\\" \\"productsearch1\\",\\"settings\\" {\\"query\\" {\\"term\\" \\"a\\"},\\"limit\\" 5,\\"typeofrecords\\" \[\\"klevu product\\"],\\"fields\\" \[\\"id\\",\\"name\\"]},\\"filters\\" {\\"filterstoreturn\\" {\\"enabled\\"\ true}}},{\\"id\\" \\"productsearch2\\",\\"settings\\" {\\"query\\" {\\"term\\" \\"b\\"},\\"limit\\" 3,\\"typeofrecords\\" \[\\"klevu product\\"],\\"fields\\" \[\\"id\\",\\"name\\"]}},{\\"id\\" \\"cmsandrecipesearch\\",\\"settings\\" {\\"query\\" {\\"term\\" \\"a\\"},\\"limit\\" 5,\\"typeofrecords\\" \[\\"klevu cms\\",\\"acme recipe\\"],\\"fields\\" \[\\"id\\",\\"name\\"]}},{\\"id\\" \\"storesearch\\",\\"settings\\" {\\"query\\" {\\"term\\" \\"a\\"},\\"limit\\" 1,\\"typeofrecords\\" \[\\"acme store\\"],\\"fields\\" \[\\"id\\",\\"name\\"]}}]});\n\nvar xhr = new xmlhttprequest();\nxhr withcredentials = false;\n\nxhr addeventlistener(\\"readystatechange\\", function() {\n if(this readystate === 4) {\n console log(this responsetext);\n }\n});\n\nxhr open(\\"post\\", \\"https //eucs15v2 ksearchnet com/cs/v2/search\\");\nxhr setrequestheader(\\"content type\\", \\"application/json\\");\n\nxhr send(data);", "language" "javascript", "customlabel" "" }, { "id" "npw0nije j5r9i5w4bgn0", "code" "okhttpclient client = new okhttpclient() newbuilder()\n build();\nmediatype mediatype = mediatype parse(\\"application/json\\");\nrequestbody body = requestbody create(mediatype, \\"{\\\n \\\\\\"context\\\\\\" {\\\n \\\\\\"apikeys\\\\\\" \[\\\n \\\\\\"klevu 156925593843210765\\\\\\"\\\n ]\\\n },\\\n \\\\\\"suggestions\\\\\\" \[\\\n {\\\n \\\\\\"id\\\\\\" \\\\\\"suggestionsearch\\\\\\",\\\n \\\\\\"typeofquery\\\\\\" \\\\\\"auto suggestions\\\\\\",\\\n \\\\\\"query\\\\\\" \\\\\\"a\\\\\\",\\\n \\\\\\"limit\\\\\\" 3\\\n }\\\n ],\\\n \\\\\\"recordqueries\\\\\\" \[\\\n {\\\n \\\\\\"id\\\\\\" \\\\\\"categorysearch\\\\\\",\\\n \\\\\\"settings\\\\\\" {\\\n \\\\\\"query\\\\\\" {\\\n \\\\\\"term\\\\\\" \\\\\\"a\\\\\\"\\\n },\\\n \\\\\\"limit\\\\\\" 3,\\\n \\\\\\"typeofrecords\\\\\\" \[\\\n \\\\\\"klevu category\\\\\\"\\\n ],\\\n \\\\\\"fields\\\\\\" \[\\\n \\\\\\"id\\\\\\",\\\n \\\\\\"name\\\\\\"\\\n ]\\\n }\\\n },\\\n {\\\n \\\\\\"id\\\\\\" \\\\\\"productsearch1\\\\\\",\\\n \\\\\\"settings\\\\\\" {\\\n \\\\\\"query\\\\\\" {\\\n \\\\\\"term\\\\\\" \\\\\\"a\\\\\\"\\\n },\\\n \\\\\\"limit\\\\\\" 5,\\\n \\\\\\"typeofrecords\\\\\\" \[\\\n \\\\\\"klevu product\\\\\\"\\\n ],\\\n \\\\\\"fields\\\\\\" \[\\\n \\\\\\"id\\\\\\",\\\n \\\\\\"name\\\\\\"\\\n ]\\\n },\\\n \\\\\\"filters\\\\\\" {\\\n \\\\\\"filterstoreturn\\\\\\" {\\\n \\\\\\"enabled\\\\\\" true\\\n }\\\n }\\\n },\\\n {\\\n \\\\\\"id\\\\\\" \\\\\\"productsearch2\\\\\\",\\\n \\\\\\"settings\\\\\\" {\\\n \\\\\\"query\\\\\\" {\\\n \\\\\\"term\\\\\\" \\\\\\"b\\\\\\"\\\n },\\\n \\\\\\"limit\\\\\\" 3,\\\n \\\\\\"typeofrecords\\\\\\" \[\\\n \\\\\\"klevu product\\\\\\"\\\n ],\\\n \\\\\\"fields\\\\\\" \[\\\n \\\\\\"id\\\\\\",\\\n \\\\\\"name\\\\\\"\\\n ]\\\n }\\\n },\\\n {\\\n \\\\\\"id\\\\\\" \\\\\\"cmsandrecipesearch\\\\\\",\\\n \\\\\\"settings\\\\\\" {\\\n \\\\\\"query\\\\\\" {\\\n \\\\\\"term\\\\\\" \\\\\\"a\\\\\\"\\\n },\\\n \\\\\\"limit\\\\\\" 5,\\\n \\\\\\"typeofrecords\\\\\\" \[\\\n \\\\\\"klevu cms\\\\\\",\\\n \\\\\\"acme recipe\\\\\\"\\\n ],\\\n \\\\\\"fields\\\\\\" \[\\\n \\\\\\"id\\\\\\",\\\n \\\\\\"name\\\\\\"\\\n ]\\\n }\\\n },\\\n {\\\n \\\\\\"id\\\\\\" \\\\\\"storesearch\\\\\\",\\\n \\\\\\"settings\\\\\\" {\\\n \\\\\\"query\\\\\\" {\\\n \\\\\\"term\\\\\\" \\\\\\"a\\\\\\"\\\n },\\\n \\\\\\"limit\\\\\\" 1,\\\n \\\\\\"typeofrecords\\\\\\" \[\\\n \\\\\\"acme store\\\\\\"\\\n ],\\\n \\\\\\"fields\\\\\\" \[\\\n \\\\\\"id\\\\\\",\\\n \\\\\\"name\\\\\\"\\\n ]\\\n }\\\n }\\\n ]\\\n}\\\n\\");\nrequest request = new request builder()\n url(\\"https //eucs15v2 ksearchnet com/cs/v2/search\\")\n method(\\"post\\", body)\n addheader(\\"content type\\", \\"application/json\\")\n build();\nresponse response = client newcall(request) execute();", "language" "java", "customlabel" "" }, { "id" "0ih7niekhhfml7cry51j ", "code" "var request = require('request');\nvar options = {\n 'method' 'post',\n 'url' 'https //eucs15v2 ksearchnet com/cs/v2/search',\n 'headers' {\n 'content type' 'application/json'\n },\n body json stringify({\\"context\\" {\\"apikeys\\" \[\\"klevu 156925593843210765\\"]},\\"suggestions\\" \[{\\"id\\" \\"suggestionsearch\\",\\"typeofquery\\" \\"auto suggestions\\",\\"query\\" \\"a\\",\\"limit\\" 3}],\\"recordqueries\\" \[{\\"id\\" \\"categorysearch\\",\\"settings\\" {\\"query\\" {\\"term\\" \\"a\\"},\\"limit\\" 3,\\"typeofrecords\\" \[\\"klevu category\\"],\\"fields\\" \[\\"id\\",\\"name\\"]}},{\\"id\\" \\"productsearch1\\",\\"settings\\" {\\"query\\" {\\"term\\" \\"a\\"},\\"limit\\" 5,\\"typeofrecords\\" \[\\"klevu product\\"],\\"fields\\" \[\\"id\\",\\"name\\"]},\\"filters\\" {\\"filterstoreturn\\" {\\"enabled\\"\ true}}},{\\"id\\" \\"productsearch2\\",\\"settings\\" {\\"query\\" {\\"term\\" \\"b\\"},\\"limit\\" 3,\\"typeofrecords\\" \[\\"klevu product\\"],\\"fields\\" \[\\"id\\",\\"name\\"]}},{\\"id\\" \\"cmsandrecipesearch\\",\\"settings\\" {\\"query\\" {\\"term\\" \\"a\\"},\\"limit\\" 5,\\"typeofrecords\\" \[\\"klevu cms\\",\\"acme recipe\\"],\\"fields\\" \[\\"id\\",\\"name\\"]}},{\\"id\\" \\"storesearch\\",\\"settings\\" {\\"query\\" {\\"term\\" \\"a\\"},\\"limit\\" 1,\\"typeofrecords\\" \[\\"acme store\\"],\\"fields\\" \[\\"id\\",\\"name\\"]}}]})\n\n};\nrequest(options, function (error, response) {\n if (error) throw new error(error);\n console log(response body);\n});\n", "language" "nodejs", "customlabel" "" } ], "selectedlanguageid" "wcdgtssqaxfiwklk2v174" }, "description" "this is an example how to search for multiple queries ", "currentnewparameter" { "label" "body parameter", "value" "bodydataparameters" } } try it here! fallback queries sometimes customers will search for something which yields few or no results in this scenario, you can either present your customer with a 'no results found' message, or you can use the result of another query to show some records which they may be interested in we call this a fallback query any query flagged as isfallbackquery true will not execute unless certain criteria are met with this approach you can present customers with alternative results, without needing to make any additional http requests, and also without the jeopardising performance of the initial query { "tab" "examples", "url" "https //{{hostname}}/cs/v2/search", "name" "fallback queries", "method" "post", "request" { "pathparameters" \[], "queryparameters" \[], "headerparameters" \[], "bodydataparameters" \[ { "kind" "required", "name" "fallbackqueryid", "type" "string", "description" "the id of another query which should be fired if the current query yields too few results " }, { "kind" "optional", "name" "fallbackwhencountlessthan", "type" "integer", "description" "use this parameter to specify the criteria for when a fallback query will be fired for example, if you would like a fallback query to fire when you have two results or less, specify a value of '3' " }, { "kind" "optional", "name" "isfallbackquery", "type" "boolean", "description" "specify a value of true for any queries that should not be executed until some particular criteria are met, in another query it is not possible for a fallback query to have its own fallback query " } ], "formdataparameters" \[] }, "results" { "languages" \[ { "id" "3xlvmt855lgkjoht0npxg", "code" "{\n \\"meta\\" {\n \\"qtime\\" 15,\n \\"responsecode\\" 200\n },\n \\"queryresults\\" \[\n {\n \\"id\\" \\"myinitialquery\\",\n \\"meta\\" {\n \\"qtime\\" 12,\n \\"noofresults\\" 12,\n \\"totalresultsfound\\" 105,\n \\"typeofsearch\\" \\"wildcard and\\",\n \\"offset\\" 0,\n \\"debugginginformation\\" {},\n \\"notificationcode\\" 1,\n \\"searchedterm\\" \\"short\\",\n \\"apikey\\" \\"klevu 156925593843210765\\",\n \\"ispersonalised\\" false\n },\n \\"records\\" \[\n {\n \\"discount\\" \\"\\",\n \\"hidegroupprices\\" \\"\\",\n \\"type\\" \\"shorts\\",\n \\"itemgroupid\\" \\"4384016334910\\",\n \\"freeshipping\\" \\"\\",\n \\"storebasecurrency\\" \\"gbp\\",\n \\"price\\" \\"45 00\\",\n \\"toprice\\" \\"\\",\n \\"imageurl\\" \\"https //cdn shopify com/s/files/1/0116/9457/1582/products/wsh12 green main 3ac6ebe5 2c3e 45cf 91cf ec54de5e5e3a medium jpg?v=1575477721\\",\n \\"currency\\" \\"gbp\\",\n \\"instock\\" \\"yes\\",\n \\"id\\" \\"31366431146046\\",\n \\"imagehover\\" \\"\\",\n \\"sku\\" \\"wsh12 28 green\\",\n \\"brand\\" \\"ksd\\",\n \\"startprice\\" \\"\\",\n \\"image\\" \\"https //cdn shopify com/s/files/1/0116/9457/1582/products/wsh12 green main 3ac6ebe5 2c3e 45cf 91cf ec54de5e5e3a medium jpg?v=1575477721\\",\n \\"deliveryinfo\\" \\"\\",\n \\"hideaddtocart\\" \\"\\",\n \\"saleprice\\" \\"45 0\\",\n \\"swatchesinfo\\" \\"\\",\n \\"weight\\" \\"\\",\n \\"klevu category\\" \\"klevu product;products;;shorts @ku\@kucategory\@ku@\\",\n \\"totalvariants\\" 0,\n \\"groupprices\\" \\"\\",\n \\"url\\" \\"https //jsv2 shopify demo ksearchmisc com/products/erika running short green\\",\n \\"tags\\" \\"body hugging, green, nylon, running, short\\",\n \\"size\\" \\"small\\",\n \\"name\\" \\"erika running short\\",\n \\"shortdesc\\" \\"a great short with a body hugging design, the erika running short is perfect for runners who prefer a fitted short rather than the traditional baggy variety • seafoam pattern running shorts • elastic waistband • snug fit • 4''\\",\n \\"category\\" \\"shorts\\"\n },\n {\n \\"discount\\" \\"\\",\n \\"hidegroupprices\\" \\"\\",\n \\"type\\" \\"shorts\\",\n \\"itemgroupid\\" \\"4384016269374\\",\n \\"freeshipping\\" \\"\\",\n \\"storebasecurrency\\" \\"gbp\\",\n \\"price\\" \\"45 00\\",\n \\"toprice\\" \\"\\",\n \\"imageurl\\" \\"https //cdn shopify com/s/files/1/0116/9457/1582/products/wsh12 purple main c57ce41e 7b0e 4cd2 a0de 18ddb6d2017a medium jpg?v=1575477720\\",\n \\"currency\\" \\"gbp\\",\n \\"instock\\" \\"yes\\",\n \\"id\\" \\"31366431080510\\",\n \\"imagehover\\" \\"\\",\n \\"sku\\" \\"wsh12 28 purple\\",\n \\"brand\\" \\"ksd\\",\n \\"startprice\\" \\"\\",\n \\"image\\" \\"https //cdn shopify com/s/files/1/0116/9457/1582/products/wsh12 purple main c57ce41e 7b0e 4cd2 a0de 18ddb6d2017a medium jpg?v=1575477720\\",\n \\"deliveryinfo\\" \\"\\",\n \\"hideaddtocart\\" \\"\\",\n \\"saleprice\\" \\"45 0\\",\n \\"swatchesinfo\\" \\"\\",\n \\"weight\\" \\"\\",\n \\"klevu category\\" \\"klevu product;products;;shorts @ku\@kucategory\@ku@\\",\n \\"totalvariants\\" 0,\n \\"groupprices\\" \\"\\",\n \\"url\\" \\"https //jsv2 shopify demo ksearchmisc com/products/erika running short purple\\",\n \\"tags\\" \\"body hugging, nylon, red, running, short\\",\n \\"size\\" \\"large\\",\n \\"name\\" \\"erika running short\\",\n \\"shortdesc\\" \\"a great short with a body hugging design, the erika running short is perfect for runners who prefer a fitted short rather than the traditional baggy variety • seafoam pattern running shorts • elastic waistband • snug fit • 4''\\",\n \\"category\\" \\"shorts\\"\n },\n {\n \\"discount\\" \\"\\",\n \\"hidegroupprices\\" \\"\\",\n \\"type\\" \\"shorts\\",\n \\"itemgroupid\\" \\"4384016203838\\",\n \\"freeshipping\\" \\"\\",\n \\"storebasecurrency\\" \\"gbp\\",\n \\"price\\" \\"45 00\\",\n \\"toprice\\" \\"\\",\n \\"imageurl\\" \\"https //cdn shopify com/s/files/1/0116/9457/1582/products/wsh12 red main 9999e03f 694d 4f0c 83ab 8c0200029275 medium jpg?v=1575477719\\",\n \\"currency\\" \\"gbp\\",\n \\"instock\\" \\"yes\\",\n \\"id\\" \\"31366431014974\\",\n \\"imagehover\\" \\"\\",\n \\"sku\\" \\"wsh12 28 red\\",\n \\"brand\\" \\"ksd\\",\n \\"startprice\\" \\"\\",\n \\"image\\" \\"https //cdn shopify com/s/files/1/0116/9457/1582/products/wsh12 red main 9999e03f 694d 4f0c 83ab 8c0200029275 medium jpg?v=1575477719\\",\n \\"deliveryinfo\\" \\"\\",\n \\"hideaddtocart\\" \\"\\",\n \\"saleprice\\" \\"45 0\\",\n \\"swatchesinfo\\" \\"\\",\n \\"weight\\" \\"\\",\n \\"klevu category\\" \\"klevu product;products;;shorts @ku\@kucategory\@ku@\\",\n \\"totalvariants\\" 0,\n \\"groupprices\\" \\"\\",\n \\"url\\" \\"https //jsv2 shopify demo ksearchmisc com/products/erika running short red\\",\n \\"tags\\" \\"body hugging, nylon, red, running, short\\",\n \\"size\\" \\"medium\\",\n \\"name\\" \\"erika running short\\",\n \\"shortdesc\\" \\"a great short with a body hugging design, the erika running short is perfect for runners who prefer a fitted short rather than the traditional baggy variety • seafoam pattern running shorts • elastic waistband • snug fit • 4''\\",\n \\"category\\" \\"shorts\\"\n },\n {\n \\"discount\\" \\"\\",\n \\"hidegroupprices\\" \\"\\",\n \\"type\\" \\"shorts\\",\n \\"itemgroupid\\" \\"4384040386622\\",\n \\"freeshipping\\" \\"\\",\n \\"storebasecurrency\\" \\"gbp\\",\n \\"price\\" \\"32 50\\",\n \\"toprice\\" \\"\\",\n \\"imageurl\\" \\"https //cdn shopify com/s/files/1/0116/9457/1582/products/msh03 black main a8796b84 9c70 4146 9c73 2295b0d260a7 medium jpg?v=1575478122\\",\n \\"currency\\" \\"gbp\\",\n \\"instock\\" \\"yes\\",\n \\"id\\" \\"31366465781822\\",\n \\"imagehover\\" \\"\\",\n \\"sku\\" \\"msh03 32 black\\",\n \\"brand\\" \\"kke\\",\n \\"startprice\\" \\"\\",\n \\"image\\" \\"https //cdn shopify com/s/files/1/0116/9457/1582/products/msh03 black main a8796b84 9c70 4146 9c73 2295b0d260a7 medium jpg?v=1575478122\\",\n \\"deliveryinfo\\" \\"\\",\n \\"hideaddtocart\\" \\"\\",\n \\"saleprice\\" \\"32 5\\",\n \\"swatchesinfo\\" \\"\\",\n \\"weight\\" \\"\\",\n \\"klevu category\\" \\"klevu product;products;;shorts @ku\@kucategory\@ku@\\",\n \\"totalvariants\\" 0,\n \\"groupprices\\" \\"\\",\n \\"url\\" \\"https //jsv2 shopify demo ksearchmisc com/products/meteor workout short black\\",\n \\"tags\\" \\"black, machine, nylon, relaxed fit, short, summer\\",\n \\"size\\" \\"small\\",\n \\"name\\" \\"meteor workout short\\",\n \\"shortdesc\\" \\"step into the meteor workout short for an incredibly lightweight fitness experience its breathable construction and an inner brief provide additional comfort and support, while the adjustable waistband offers the perfect fit to take you to the fi\\",\n \\"category\\" \\"shorts\\"\n },\n {\n \\"discount\\" \\"\\",\n \\"hidegroupprices\\" \\"\\",\n \\"type\\" \\"shorts\\",\n \\"itemgroupid\\" \\"4384039665726\\",\n \\"freeshipping\\" \\"\\",\n \\"storebasecurrency\\" \\"gbp\\",\n \\"price\\" \\"29 00\\",\n \\"toprice\\" \\"\\",\n \\"imageurl\\" \\"https //cdn shopify com/s/files/1/0116/9457/1582/products/msh05 gray main 0f869cff 09fb 403a a209 cf092f4d3c1a medium jpg?v=1575478112\\",\n \\"currency\\" \\"gbp\\",\n \\"instock\\" \\"yes\\",\n \\"id\\" \\"31366465060926\\",\n \\"imagehover\\" \\"\\",\n \\"sku\\" \\"msh05 32 gray\\",\n \\"brand\\" \\"ksd\\",\n \\"startprice\\" \\"\\",\n \\"image\\" \\"https //cdn shopify com/s/files/1/0116/9457/1582/products/msh05 gray main 0f869cff 09fb 403a a209 cf092f4d3c1a medium jpg?v=1575478112\\",\n \\"deliveryinfo\\" \\"\\",\n \\"hideaddtocart\\" \\"\\",\n \\"saleprice\\" \\"29 0\\",\n \\"swatchesinfo\\" \\"\\",\n \\"weight\\" \\"\\",\n \\"klevu category\\" \\"klevu product;products;;shorts @ku\@kucategory\@ku@\\",\n \\"totalvariants\\" 0,\n \\"groupprices\\" \\"\\",\n \\"url\\" \\"https //jsv2 shopify demo ksearchmisc com/products/hawkeye yoga short gray\\",\n \\"tags\\" \\"gray, machine, nylon, relaxed fit, short, summer\\",\n \\"size\\" \\"medium\\",\n \\"name\\" \\"hawkeye yoga short\\",\n \\"shortdesc\\" \\"what more do you need than a sporty yoga short made with organic cotton and a little spandex for mobility? the hawkeye yoga short brings a stylish, standard fit you can sport with confidence outside the studio • dark gray shorts with red a\\",\n \\"category\\" \\"shorts\\"\n },\n {\n \\"discount\\" \\"\\",\n \\"hidegroupprices\\" \\"\\",\n \\"type\\" \\"shorts\\",\n \\"itemgroupid\\" \\"4384037830718\\",\n \\"freeshipping\\" \\"\\",\n \\"storebasecurrency\\" \\"gbp\\",\n \\"price\\" \\"27 00\\",\n \\"toprice\\" \\"\\",\n \\"imageurl\\" \\"https //cdn shopify com/s/files/1/0116/9457/1582/products/msh12 black main 2ef78733 04a5 4345 9f5f 992d0cfffe8d medium jpg?v=1575478090\\",\n \\"currency\\" \\"gbp\\",\n \\"instock\\" \\"yes\\",\n \\"id\\" \\"31366462472254\\",\n \\"imagehover\\" \\"\\",\n \\"sku\\" \\"msh12 32 black\\",\n \\"brand\\" \\"kke\\",\n \\"startprice\\" \\"\\",\n \\"image\\" \\"https //cdn shopify com/s/files/1/0116/9457/1582/products/msh12 black main 2ef78733 04a5 4345 9f5f 992d0cfffe8d medium jpg?v=1575478090\\",\n \\"deliveryinfo\\" \\"\\",\n \\"hideaddtocart\\" \\"\\",\n \\"saleprice\\" \\"27 0\\",\n \\"swatchesinfo\\" \\"\\",\n \\"weight\\" \\"\\",\n \\"klevu category\\" \\"klevu product;products;;shorts @ku\@kucategory\@ku@\\",\n \\"totalvariants\\" 0,\n \\"groupprices\\" \\"\\",\n \\"url\\" \\"https //jsv2 shopify demo ksearchmisc com/products/pierce gym short black\\",\n \\"tags\\" \\"black, machine, nylon, relaxed fit, short, summer\\",\n \\"size\\" \\"small\\",\n \\"name\\" \\"pierce gym short\\",\n \\"shortdesc\\" \\"the pierce gym short is similar to our arcadio gym short, but designed with a fitted, tapered look a flat waistband with an adjustable drawstring adds comfort, with zippered pockets for safe, easy storage • dark red cotton shorts • 8\\",\n \\"category\\" \\"shorts\\"\n },\n {\n \\"discount\\" \\"\\",\n \\"hidegroupprices\\" \\"\\",\n \\"type\\" \\"shorts\\",\n \\"itemgroupid\\" \\"4384039796798\\",\n \\"freeshipping\\" \\"\\",\n \\"storebasecurrency\\" \\"gbp\\",\n \\"price\\" \\"29 00\\",\n \\"toprice\\" \\"\\",\n \\"imageurl\\" \\"https //cdn shopify com/s/files/1/0116/9457/1582/products/msh05 black main f61ee526 b9d3 4eaa b7b2 80dc400f31b0 medium jpg?v=1575478115\\",\n \\"currency\\" \\"gbp\\",\n \\"instock\\" \\"yes\\",\n \\"id\\" \\"31366465191998\\",\n \\"imagehover\\" \\"\\",\n \\"sku\\" \\"msh05 32 black\\",\n \\"brand\\" \\"kke\\",\n \\"startprice\\" \\"\\",\n \\"image\\" \\"https //cdn shopify com/s/files/1/0116/9457/1582/products/msh05 black main f61ee526 b9d3 4eaa b7b2 80dc400f31b0 medium jpg?v=1575478115\\",\n \\"deliveryinfo\\" \\"\\",\n \\"hideaddtocart\\" \\"\\",\n \\"saleprice\\" \\"29 0\\",\n \\"swatchesinfo\\" \\"\\",\n \\"weight\\" \\"\\",\n \\"klevu category\\" \\"klevu product;products;;shorts @ku\@kucategory\@ku@\\",\n \\"totalvariants\\" 0,\n \\"groupprices\\" \\"\\",\n \\"url\\" \\"https //jsv2 shopify demo ksearchmisc com/products/hawkeye yoga short black\\",\n \\"tags\\" \\"black, machine, motion friendly, nylon, relaxed fit, smooth, summer, yoga short\\",\n \\"size\\" \\"small\\",\n \\"name\\" \\"hawkeye yoga short\\",\n \\"shortdesc\\" \\"what more do you need than a sporty yoga short made with organic cotton and a little spandex for mobility? the hawkeye yoga short brings a stylish, standard fit you can sport with confidence outside the studio • dark gray shorts with red a\\",\n \\"category\\" \\"shorts\\"\n },\n {\n \\"discount\\" \\"\\",\n \\"hidegroupprices\\" \\"\\",\n \\"type\\" \\"shorts\\",\n \\"itemgroupid\\" \\"4384039731262\\",\n \\"freeshipping\\" \\"\\",\n \\"storebasecurrency\\" \\"gbp\\",\n \\"price\\" \\"29 00\\",\n \\"toprice\\" \\"\\",\n \\"imageurl\\" \\"https //cdn shopify com/s/files/1/0116/9457/1582/products/msh05 blue main 2130114d 06b0 4793 8fc2 bf77411297e4 medium jpg?v=1575478114\\",\n \\"currency\\" \\"gbp\\",\n \\"instock\\" \\"yes\\",\n \\"id\\" \\"31366465126462\\",\n \\"imagehover\\" \\"\\",\n \\"sku\\" \\"msh05 32 blue\\",\n \\"brand\\" \\"mnh\\",\n \\"startprice\\" \\"\\",\n \\"image\\" \\"https //cdn shopify com/s/files/1/0116/9457/1582/products/msh05 blue main 2130114d 06b0 4793 8fc2 bf77411297e4 medium jpg?v=1575478114\\",\n \\"deliveryinfo\\" \\"\\",\n \\"hideaddtocart\\" \\"\\",\n \\"saleprice\\" \\"29 0\\",\n \\"swatchesinfo\\" \\"\\",\n \\"weight\\" \\"\\",\n \\"klevu category\\" \\"klevu product;products;;shorts @ku\@kucategory\@ku@\\",\n \\"totalvariants\\" 0,\n \\"groupprices\\" \\"\\",\n \\"url\\" \\"https //jsv2 shopify demo ksearchmisc com/products/hawkeye yoga short blue\\",\n \\"tags\\" \\"blue, machine, nylon, relaxed fit, short, summer\\",\n \\"size\\" \\"large\\",\n \\"name\\" \\"hawkeye yoga short\\",\n \\"shortdesc\\" \\"what more do you need than a sporty yoga short made with organic cotton and a little spandex for mobility? the hawkeye yoga short brings a stylish, standard fit you can sport with confidence outside the studio • dark gray shorts with red a\\",\n \\"category\\" \\"shorts\\"\n },\n {\n \\"discount\\" \\"\\",\n \\"hidegroupprices\\" \\"\\",\n \\"type\\" \\"shorts\\",\n \\"itemgroupid\\" \\"4384037765182\\",\n \\"freeshipping\\" \\"\\",\n \\"storebasecurrency\\" \\"gbp\\",\n \\"price\\" \\"27 00\\",\n \\"toprice\\" \\"\\",\n \\"imageurl\\" \\"https //cdn shopify com/s/files/1/0116/9457/1582/products/msh12 gray main 4bb28c53 a928 47a0 92ea ecd303f97dba medium jpg?v=1575478089\\",\n \\"currency\\" \\"gbp\\",\n \\"instock\\" \\"yes\\",\n \\"id\\" \\"31366462439486\\",\n \\"imagehover\\" \\"\\",\n \\"sku\\" \\"msh12 32 gray\\",\n \\"brand\\" \\"mnh\\",\n \\"startprice\\" \\"\\",\n \\"image\\" \\"https //cdn shopify com/s/files/1/0116/9457/1582/products/msh12 gray main 4bb28c53 a928 47a0 92ea ecd303f97dba medium jpg?v=1575478089\\",\n \\"deliveryinfo\\" \\"\\",\n \\"hideaddtocart\\" \\"\\",\n \\"saleprice\\" \\"27 0\\",\n \\"swatchesinfo\\" \\"\\",\n \\"weight\\" \\"\\",\n \\"klevu category\\" \\"klevu product;products;;shorts @ku\@kucategory\@ku@\\",\n \\"totalvariants\\" 0,\n \\"groupprices\\" \\"\\",\n \\"url\\" \\"https //jsv2 shopify demo ksearchmisc com/products/pierce gym short gray\\",\n \\"tags\\" \\"gray, machine, nylon, relaxed fit, short, summer\\",\n \\"size\\" \\"large\\",\n \\"name\\" \\"pierce gym short\\",\n \\"shortdesc\\" \\"the pierce gym short is similar to our arcadio gym short, but designed with a fitted, tapered look a flat waistband with an adjustable drawstring adds comfort, with zippered pockets for safe, easy storage • dark red cotton shorts • 8\\",\n \\"category\\" \\"shorts\\"\n },\n {\n \\"discount\\" \\"\\",\n \\"hidegroupprices\\" \\"\\",\n \\"type\\" \\"shorts\\",\n \\"itemgroupid\\" \\"4384037699646\\",\n \\"freeshipping\\" \\"\\",\n \\"storebasecurrency\\" \\"gbp\\",\n \\"price\\" \\"27 00\\",\n \\"toprice\\" \\"\\",\n \\"imageurl\\" \\"https //cdn shopify com/s/files/1/0116/9457/1582/products/msh12 red main 6c29f610 d5f7 4e1a bde4 1fb148964be5 medium jpg?v=1575478088\\",\n \\"currency\\" \\"gbp\\",\n \\"instock\\" \\"yes\\",\n \\"id\\" \\"31366462373950\\",\n \\"imagehover\\" \\"\\",\n \\"sku\\" \\"msh12 32 red\\",\n \\"brand\\" \\"ksd\\",\n \\"startprice\\" \\"\\",\n \\"image\\" \\"https //cdn shopify com/s/files/1/0116/9457/1582/products/msh12 red main 6c29f610 d5f7 4e1a bde4 1fb148964be5 medium jpg?v=1575478088\\",\n \\"deliveryinfo\\" \\"\\",\n \\"hideaddtocart\\" \\"\\",\n \\"saleprice\\" \\"27 0\\",\n \\"swatchesinfo\\" \\"\\",\n \\"weight\\" \\"\\",\n \\"klevu category\\" \\"klevu product;products;;shorts @ku\@kucategory\@ku@\\",\n \\"totalvariants\\" 0,\n \\"groupprices\\" \\"\\",\n \\"url\\" \\"https //jsv2 shopify demo ksearchmisc com/products/pierce gym short red\\",\n \\"tags\\" \\"cotton, machine, relaxed fit, res, short, summer\\",\n \\"size\\" \\"medium\\",\n \\"name\\" \\"pierce gym short\\",\n \\"shortdesc\\" \\"the pierce gym short is similar to our arcadio gym short, but designed with a fitted, tapered look a flat waistband with an adjustable drawstring adds comfort, with zippered pockets for safe, easy storage • dark red cotton shorts • 8\\",\n \\"category\\" \\"shorts\\"\n },\n {\n \\"discount\\" \\"\\",\n \\"hidegroupprices\\" \\"\\",\n \\"type\\" \\"shorts\\",\n \\"itemgroupid\\" \\"4384038322238\\",\n \\"freeshipping\\" \\"\\",\n \\"storebasecurrency\\" \\"gbp\\",\n \\"price\\" \\"32 00\\",\n \\"toprice\\" \\"\\",\n \\"imageurl\\" \\"https //cdn shopify com/s/files/1/0116/9457/1582/products/msh10 blue main 774a1fbb 9eab 4d4f 9261 f1e0c028b492 medium jpg?v=1575478097\\",\n \\"currency\\" \\"gbp\\",\n \\"instock\\" \\"yes\\",\n \\"id\\" \\"31366463094846\\",\n \\"imagehover\\" \\"\\",\n \\"sku\\" \\"msh10 32 blue\\",\n \\"brand\\" \\"kke\\",\n \\"startprice\\" \\"\\",\n \\"image\\" \\"https //cdn shopify com/s/files/1/0116/9457/1582/products/msh10 blue main 774a1fbb 9eab 4d4f 9261 f1e0c028b492 medium jpg?v=1575478097\\",\n \\"deliveryinfo\\" \\"\\",\n \\"hideaddtocart\\" \\"\\",\n \\"saleprice\\" \\"32 0\\",\n \\"swatchesinfo\\" \\"\\",\n \\"weight\\" \\"\\",\n \\"klevu category\\" \\"klevu product;products;;shorts @ku\@kucategory\@ku@\\",\n \\"totalvariants\\" 0,\n \\"groupprices\\" \\"\\",\n \\"url\\" \\"https //jsv2 shopify demo ksearchmisc com/products/sol active short blue\\",\n \\"tags\\" \\"blue, machine, navy polyster, relaxed fit, short, summer\\",\n \\"size\\" \\"small\\",\n \\"name\\" \\"sol active short\\",\n \\"shortdesc\\" \\"you'll let your fear go and push your limits in your new sol active short featuring ultra breathable performance fabric and a flat comfort fit waistband, the sol active short is perfect for high intensity circuits or high heat bikram • li\\",\n \\"category\\" \\"shorts\\"\n },\n {\n \\"discount\\" \\"\\",\n \\"hidegroupprices\\" \\"\\",\n \\"type\\" \\"shorts\\",\n \\"itemgroupid\\" \\"4384038256702\\",\n \\"freeshipping\\" \\"\\",\n \\"storebasecurrency\\" \\"gbp\\",\n \\"price\\" \\"32 00\\",\n \\"toprice\\" \\"\\",\n \\"imageurl\\" \\"https //cdn shopify com/s/files/1/0116/9457/1582/products/msh10 green main 18d664f2 5ba2 421d b89a 87cb73d86416 medium jpg?v=1575478095\\",\n \\"currency\\" \\"gbp\\",\n \\"instock\\" \\"yes\\",\n \\"id\\" \\"31366463029310\\",\n \\"imagehover\\" \\"\\",\n \\"sku\\" \\"msh10 32 green\\",\n \\"brand\\" \\"mnh\\",\n \\"startprice\\" \\"\\",\n \\"image\\" \\"https //cdn shopify com/s/files/1/0116/9457/1582/products/msh10 green main 18d664f2 5ba2 421d b89a 87cb73d86416 medium jpg?v=1575478095\\",\n \\"deliveryinfo\\" \\"\\",\n \\"hideaddtocart\\" \\"\\",\n \\"saleprice\\" \\"32 0\\",\n \\"swatchesinfo\\" \\"\\",\n \\"weight\\" \\"\\",\n \\"klevu category\\" \\"klevu product;products;;shorts @ku\@kucategory\@ku@\\",\n \\"totalvariants\\" 0,\n \\"groupprices\\" \\"\\",\n \\"url\\" \\"https //jsv2 shopify demo ksearchmisc com/products/sol active short green\\",\n \\"tags\\" \\"green, machine, nylon, relaxed fit, short, summer\\",\n \\"size\\" \\"large\\",\n \\"name\\" \\"sol active short\\",\n \\"shortdesc\\" \\"you'll let your fear go and push your limits in your new sol active short featuring ultra breathable performance fabric and a flat comfort fit waistband, the sol active short is perfect for high intensity circuits or high heat bikram • li\\",\n \\"category\\" \\"shorts\\"\n }\n ],\n \\"filters\\" \[]\n }\n ]\n}", "language" "200", "customlabel" "" } ], "selectedlanguageid" "3xlvmt855lgkjoht0npxg" }, "examples" { "languages" \[ { "id" "jsu7dlyyj euh63ysp682", "code" "{\n \\"recordqueries\\" \[\n {\n \\"id\\" \\"myinitialquery\\",\n \\"settings\\" {\n \\"query\\" {\n \\"term\\" \\"short\\"\n },\n \\"typeofsearch\\" \\"wildcard and\\",\n \\"fallbackqueryid\\" \\"myfallbackquery\\",\n \\"fallbackwhencountlessthan\\" 3\n }\n },\n {\n \\"id\\" \\"myfallbackquery\\",\n \\"isfallbackquery\\" true,\n \\"settings\\" {\n \\"query\\" {\n \\"term\\" \\"short\\"\n },\n \\"typeofsearch\\" \\"fuzzy or\\"\n }\n }\n ],\n \\"context\\" {\n \\"apikeys\\" \[\n \\"klevu 156925593843210765\\"\n ]\n }\n}", "language" "json", "customlabel" "request body (json)" }, { "id" "8yg33te4jzfowp5yebmjh", "code" "\<?php\n\n$curl = curl init();\n\ncurl setopt array($curl, array(\n curlopt url => 'https //eucs15v2 ksearchnet com/cs/v2/search',\n curlopt returntransfer => true,\n curlopt encoding => '',\n curlopt maxredirs => 10,\n curlopt timeout => 0,\n curlopt followlocation => true,\n curlopt http version => curl http version 1 1,\n curlopt customrequest => 'post',\n curlopt postfields =>'{\n \\"recordqueries\\" \[\n {\n \\"id\\" \\"myinitialquery\\",\n \\"settings\\" {\n \\"query\\" {\n \\"term\\" \\"short\\"\n },\n \\"typeofsearch\\" \\"wildcard and\\",\n \\"fallbackqueryid\\" \\"myfallbackquery\\",\n \\"fallbackwhencountlessthan\\" 3\n }\n },\n {\n \\"id\\" \\"myfallbackquery\\",\n \\"isfallbackquery\\" true,\n \\"settings\\" {\n \\"query\\" {\n \\"term\\" \\"short\\"\n },\n \\"typeofsearch\\" \\"fuzzy or\\"\n }\n }\n ],\n \\"context\\" {\n \\"apikeys\\" \[\n \\"klevu 156925593843210765\\"\n ]\n }\n}',\n curlopt httpheader => array(\n 'content type application/json'\n ),\n));\n\n$response = curl exec($curl);\n\ncurl close($curl);\necho $response;\n", "language" "php", "customlabel" "" }, { "id" "wcdgtssqaxfiwklk2v174", "code" "var data = json stringify({\\"recordqueries\\" \[{\\"id\\" \\"myinitialquery\\",\\"settings\\" {\\"query\\" {\\"term\\" \\"short\\"},\\"typeofsearch\\" \\"wildcard and\\",\\"fallbackqueryid\\" \\"myfallbackquery\\",\\"fallbackwhencountlessthan\\" 3}},{\\"id\\" \\"myfallbackquery\\",\\"isfallbackquery\\"\ true,\\"settings\\" {\\"query\\" {\\"term\\" \\"short\\"},\\"typeofsearch\\" \\"fuzzy or\\"}}],\\"context\\" {\\"apikeys\\" \[\\"klevu 156925593843210765\\"]}});\n\nvar xhr = new xmlhttprequest();\nxhr withcredentials = false;\n\nxhr addeventlistener(\\"readystatechange\\", function() {\n if(this readystate === 4) {\n console log(this responsetext);\n }\n});\n\nxhr open(\\"post\\", \\"https //eucs15v2 ksearchnet com/cs/v2/search\\");\nxhr setrequestheader(\\"content type\\", \\"application/json\\");\n\nxhr send(data);", "language" "javascript", "customlabel" "" }, { "id" "npw0nije j5r9i5w4bgn0", "code" "okhttpclient client = new okhttpclient() newbuilder()\n build();\nmediatype mediatype = mediatype parse(\\"application/json\\");\nrequestbody body = requestbody create(mediatype, \\"{\\\n \\\\\\"recordqueries\\\\\\" \[\\\n {\\\n \\\\\\"id\\\\\\" \\\\\\"myinitialquery\\\\\\",\\\n \\\\\\"settings\\\\\\" {\\\n \\\\\\"query\\\\\\" {\\\n \\\\\\"term\\\\\\" \\\\\\"short\\\\\\"\\\n },\\\n \\\\\\"typeofsearch\\\\\\" \\\\\\"wildcard and\\\\\\",\\\n \\\\\\"fallbackqueryid\\\\\\" \\\\\\"myfallbackquery\\\\\\",\\\n \\\\\\"fallbackwhencountlessthan\\\\\\" 3\\\n }\\\n },\\\n {\\\n \\\\\\"id\\\\\\" \\\\\\"myfallbackquery\\\\\\",\\\n \\\\\\"isfallbackquery\\\\\\" true,\\\n \\\\\\"settings\\\\\\" {\\\n \\\\\\"query\\\\\\" {\\\n \\\\\\"term\\\\\\" \\\\\\"short\\\\\\"\\\n },\\\n \\\\\\"typeofsearch\\\\\\" \\\\\\"fuzzy or\\\\\\"\\\n }\\\n }\\\n ],\\\n \\\\\\"context\\\\\\" {\\\n \\\\\\"apikeys\\\\\\" \[\\\n \\\\\\"klevu 156925593843210765\\\\\\"\\\n ]\\\n }\\\n}\\");\nrequest request = new request builder()\n url(\\"https //eucs15v2 ksearchnet com/cs/v2/search\\")\n method(\\"post\\", body)\n addheader(\\"content type\\", \\"application/json\\")\n build();\nresponse response = client newcall(request) execute();", "language" "java", "customlabel" "" }, { "id" "0ih7niekhhfml7cry51j ", "code" "var request = require('request');\nvar options = {\n 'method' 'post',\n 'url' 'https //eucs15v2 ksearchnet com/cs/v2/search',\n 'headers' {\n 'content type' 'application/json'\n },\n body json stringify({\\"recordqueries\\" \[{\\"id\\" \\"myinitialquery\\",\\"settings\\" {\\"query\\" {\\"term\\" \\"short\\"},\\"typeofsearch\\" \\"wildcard and\\",\\"fallbackqueryid\\" \\"myfallbackquery\\",\\"fallbackwhencountlessthan\\" 3}},{\\"id\\" \\"myfallbackquery\\",\\"isfallbackquery\\"\ true,\\"settings\\" {\\"query\\" {\\"term\\" \\"short\\"},\\"typeofsearch\\" \\"fuzzy or\\"}}],\\"context\\" {\\"apikeys\\" \[\\"klevu 156925593843210765\\"]}})\n\n};\nrequest(options, function (error, response) {\n if (error) throw new error(error);\n console log(response body);\n});\n", "language" "nodejs", "customlabel" "" } ], "selectedlanguageid" "wcdgtssqaxfiwklk2v174" }, "description" "this is an example how to fetch results as a part of fall back queries ", "currentnewparameter" { "label" "body parameter", "value" "bodydataparameters" } } try it here! hand picked products sometimes merchants want to take control over which records are included or excluded, or whether certain records should always take precedence over others this can be done via query time manual merchandising { "tab" "examples", "url" "https //{{hostname}}/cs/v2/search", "name" "hand picked queries", "method" "post", "request" { "pathparameters" \[], "queryparameters" \[], "headerparameters" \[], "bodydataparameters" \[ { "kind" "required", "name" "topids", "type" "array", "description" "specify any records which should always be displayed at the top of the result set you can specify a record id to control this at variant level, or a itemgroupid to control this at compound item level \n\nnote that this is only applicable when the sort order is by 'relevance' " }, { "kind" "optional", "name" "includeids", "type" "array", "description" "specify any records which should be included with the results, even if the klevu search query did not match them you can specify a record id to control this at variant level, or a itemgroupid to control this at compound item level " }, { "kind" "optional", "name" "excludeids", "type" "array", "description" "use this field to exclude certain records from the search results you can specify a record id to control this at variant level, or an itemgroupid to control this at compound level " } ], "formdataparameters" \[] }, "results" { "languages" \[ { "id" "3xlvmt855lgkjoht0npxg", "code" "{\n \\"meta\\" {\n \\"qtime\\" 12,\n \\"responsecode\\" 200\n },\n \\"queryresults\\" \[\n {\n \\"id\\" \\"productsearch\\",\n \\"meta\\" {\n \\"qtime\\" 8,\n \\"noofresults\\" 10,\n \\"totalresultsfound\\" 105,\n \\"typeofsearch\\" \\"wildcard and\\",\n \\"offset\\" 0,\n \\"debugginginformation\\" {},\n \\"notificationcode\\" 1,\n \\"searchedterm\\" \\"short\\",\n \\"apikey\\" \\"klevu 156925593843210765\\",\n \\"ispersonalised\\" false\n },\n \\"records\\" \[\n {\n \\"name\\" \\"summit watch\\",\n \\"id\\" \\"31366496223294\\",\n \\"itemgroupid\\" \\"4384059031614\\"\n },\n {\n \\"name\\" \\"erika running short\\",\n \\"id\\" \\"31366431146046\\",\n \\"itemgroupid\\" \\"4384016334910\\"\n },\n {\n \\"name\\" \\"erika running short\\",\n \\"id\\" \\"31366431014974\\",\n \\"itemgroupid\\" \\"4384016203838\\"\n },\n {\n \\"name\\" \\"erika running short\\",\n \\"id\\" \\"31366431080510\\",\n \\"itemgroupid\\" \\"4384016269374\\"\n },\n {\n \\"name\\" \\"meteor workout short\\",\n \\"id\\" \\"31366465781822\\",\n \\"itemgroupid\\" \\"4384040386622\\"\n },\n {\n \\"name\\" \\"hawkeye yoga short\\",\n \\"id\\" \\"31366465191998\\",\n \\"itemgroupid\\" \\"4384039796798\\"\n },\n {\n \\"name\\" \\"hawkeye yoga short\\",\n \\"id\\" \\"31366465060926\\",\n \\"itemgroupid\\" \\"4384039665726\\"\n },\n {\n \\"name\\" \\"hawkeye yoga short\\",\n \\"id\\" \\"31366465126462\\",\n \\"itemgroupid\\" \\"4384039731262\\"\n },\n {\n \\"name\\" \\"pierce gym short\\",\n \\"id\\" \\"31366462439486\\",\n \\"itemgroupid\\" \\"4384037765182\\"\n },\n {\n \\"name\\" \\"pierce gym short\\",\n \\"id\\" \\"31366462373950\\",\n \\"itemgroupid\\" \\"4384037699646\\"\n }\n ],\n \\"filters\\" \[]\n }\n ]\n}", "language" "200", "customlabel" "" } ], "selectedlanguageid" "3xlvmt855lgkjoht0npxg" }, "examples" { "languages" \[ { "id" "jsu7dlyyj euh63ysp682", "code" "{\n \\"recordqueries\\" \[\n {\n \\"settings\\" {\n \\"topids\\" \[\n {\n \\"key\\" \\"id\\",\n \\"value\\" \\"31366496223294\\"\n },\n {\n \\"key\\" \\"itemgroupid\\",\n \\"value\\" \\"4384052412478\\"\n }\n ],\n \\"includeids\\" \[\n {\n \\"key\\" \\"id\\",\n \\"value\\" \\"31366496223294\\"\n }\n ],\n \\"excludeids\\" \[\n {\n \\"key\\" \\"id\\",\n \\"value\\" \\"31366451953726\\"\n }\n ],\n \\"query\\" {\n \\"term\\" \\"short\\"\n },\n \\"typeofrecords\\" \[\n \\"klevu product\\"\n ],\n \\"fields\\" \[\n \\"id\\",\n \\"name\\",\n \\"itemgroupid\\"\n ],\n \\"limit\\" 10\n },\n \\"id\\" \\"productsearch\\"\n }\n ],\n \\"context\\" {\n \\"apikeys\\" \[\n \\"klevu 156925593843210765\\"\n ]\n }\n}", "language" "json", "customlabel" "request body (json)" }, { "id" "8yg33te4jzfowp5yebmjh", "code" "\<?php\n\n$curl = curl init();\n\ncurl setopt array($curl, array(\n curlopt url => 'https //eucs15v2 ksearchnet com/cs/v2/search',\n curlopt returntransfer => true,\n curlopt encoding => '',\n curlopt maxredirs => 10,\n curlopt timeout => 0,\n curlopt followlocation => true,\n curlopt http version => curl http version 1 1,\n curlopt customrequest => 'post',\n curlopt postfields =>'{\n \\"recordqueries\\" \[\n {\n \\"settings\\" {\n \\"topids\\" \[\n {\n \\"key\\" \\"id\\",\n \\"value\\" \\"31366496223294\\"\n },\n {\n \\"key\\" \\"itemgroupid\\",\n \\"value\\" \\"4384052412478\\"\n }\n ],\n \\"includeids\\" \[\n {\n \\"key\\" \\"id\\",\n \\"value\\" \\"31366496223294\\"\n }\n ],\n \\"excludeids\\" \[\n {\n \\"key\\" \\"id\\",\n \\"value\\" \\"31366451953726\\"\n }\n ],\n \\"query\\" {\n \\"term\\" \\"short\\"\n },\n \\"typeofrecords\\" \[\n \\"klevu product\\"\n ],\n \\"fields\\" \[\n \\"id\\",\n \\"name\\",\n \\"itemgroupid\\"\n ],\n \\"limit\\" 10\n },\n \\"id\\" \\"productsearch\\"\n }\n ],\n \\"context\\" {\n \\"apikeys\\" \[\n \\"klevu 156925593843210765\\"\n ]\n }\n}',\n curlopt httpheader => array(\n 'content type application/json'\n ),\n));\n\n$response = curl exec($curl);\n\ncurl close($curl);\necho $response;\n", "language" "php", "customlabel" "" }, { "id" "wcdgtssqaxfiwklk2v174", "code" "var data = json stringify({\\"recordqueries\\" \[{\\"settings\\" {\\"topids\\" \[{\\"key\\" \\"id\\",\\"value\\" \\"31366496223294\\"},{\\"key\\" \\"itemgroupid\\",\\"value\\" \\"4384052412478\\"}],\\"includeids\\" \[{\\"key\\" \\"id\\",\\"value\\" \\"31366496223294\\"}],\\"excludeids\\" \[{\\"key\\" \\"id\\",\\"value\\" \\"31366451953726\\"}],\\"query\\" {\\"term\\" \\"short\\"},\\"typeofrecords\\" \[\\"klevu product\\"],\\"fields\\" \[\\"id\\",\\"name\\",\\"itemgroupid\\"],\\"limit\\" 10},\\"id\\" \\"productsearch\\"}],\\"context\\" {\\"apikeys\\" \[\\"klevu 156925593843210765\\"]}});\n\nvar xhr = new xmlhttprequest();\nxhr withcredentials = false;\n\nxhr addeventlistener(\\"readystatechange\\", function() {\n if(this readystate === 4) {\n console log(this responsetext);\n }\n});\n\nxhr open(\\"post\\", \\"https //eucs15v2 ksearchnet com/cs/v2/search\\");\nxhr setrequestheader(\\"content type\\", \\"application/json\\");\n\nxhr send(data);", "language" "javascript", "customlabel" "" }, { "id" "npw0nije j5r9i5w4bgn0", "code" "okhttpclient client = new okhttpclient() newbuilder()\n build();\nmediatype mediatype = mediatype parse(\\"application/json\\");\nrequestbody body = requestbody create(mediatype, \\"{\\\n \\\\\\"recordqueries\\\\\\" \[\\\n {\\\n \\\\\\"settings\\\\\\" {\\\n \\\\\\"topids\\\\\\" \[\\\n {\\\n \\\\\\"key\\\\\\" \\\\\\"id\\\\\\",\\\n \\\\\\"value\\\\\\" \\\\\\"31366496223294\\\\\\"\\\n },\\\n {\\\n \\\\\\"key\\\\\\" \\\\\\"itemgroupid\\\\\\",\\\n \\\\\\"value\\\\\\" \\\\\\"4384052412478\\\\\\"\\\n }\\\n ],\\\n \\\\\\"includeids\\\\\\" \[\\\n {\\\n \\\\\\"key\\\\\\" \\\\\\"id\\\\\\",\\\n \\\\\\"value\\\\\\" \\\\\\"31366496223294\\\\\\"\\\n }\\\n ],\\\n \\\\\\"excludeids\\\\\\" \[\\\n {\\\n \\\\\\"key\\\\\\" \\\\\\"id\\\\\\",\\\n \\\\\\"value\\\\\\" \\\\\\"31366451953726\\\\\\"\\\n }\\\n ],\\\n \\\\\\"query\\\\\\" {\\\n \\\\\\"term\\\\\\" \\\\\\"short\\\\\\"\\\n },\\\n \\\\\\"typeofrecords\\\\\\" \[\\\n \\\\\\"klevu product\\\\\\"\\\n ],\\\n \\\\\\"fields\\\\\\" \[\\\n \\\\\\"id\\\\\\",\\\n \\\\\\"name\\\\\\",\\\n \\\\\\"itemgroupid\\\\\\"\\\n ],\\\n \\\\\\"limit\\\\\\" 10\\\n },\\\n \\\\\\"id\\\\\\" \\\\\\"productsearch\\\\\\"\\\n }\\\n ],\\\n \\\\\\"context\\\\\\" {\\\n \\\\\\"apikeys\\\\\\" \[\\\n \\\\\\"klevu 156925593843210765\\\\\\"\\\n ]\\\n }\\\n}\\");\nrequest request = new request builder()\n url(\\"https //eucs15v2 ksearchnet com/cs/v2/search\\")\n method(\\"post\\", body)\n addheader(\\"content type\\", \\"application/json\\")\n build();\nresponse response = client newcall(request) execute();", "language" "java", "customlabel" "" }, { "id" "0ih7niekhhfml7cry51j ", "code" "var request = require('request');\nvar options = {\n 'method' 'post',\n 'url' 'https //eucs15v2 ksearchnet com/cs/v2/search',\n 'headers' {\n 'content type' 'application/json'\n },\n body json stringify({\\"recordqueries\\" \[{\\"settings\\" {\\"topids\\" \[{\\"key\\" \\"id\\",\\"value\\" \\"31366496223294\\"},{\\"key\\" \\"itemgroupid\\",\\"value\\" \\"4384052412478\\"}],\\"includeids\\" \[{\\"key\\" \\"id\\",\\"value\\" \\"31366496223294\\"}],\\"excludeids\\" \[{\\"key\\" \\"id\\",\\"value\\" \\"31366451953726\\"}],\\"query\\" {\\"term\\" \\"short\\"},\\"typeofrecords\\" \[\\"klevu product\\"],\\"fields\\" \[\\"id\\",\\"name\\",\\"itemgroupid\\"],\\"limit\\" 10},\\"id\\" \\"productsearch\\"}],\\"context\\" {\\"apikeys\\" \[\\"klevu 156925593843210765\\"]}})\n\n};\nrequest(options, function (error, response) {\n if (error) throw new error(error);\n console log(response body);\n});\n", "language" "nodejs", "customlabel" "" } ], "selectedlanguageid" "wcdgtssqaxfiwklk2v174" }, "description" "this is an example how to merchandise search results using apis ", "currentnewparameter" { "label" "body parameter", "value" "bodydataparameters" } } try it here! custom queries deprecated the use of customandquery is being deprecated for better control over custom queries please review and use advanced filtering docid\ rbt4zzdiheip1lcuk8n r you can even write your own custom queries with klevu search, to take more control over your results the example to the right shows how you can build a query to filter results by small or medium records which are not brand "kke " { "tab" "examples", "url" "https //{{hostname}}/cs/v2/search", "name" "custom queries", "method" "post", "request" { "pathparameters" \[], "queryparameters" \[], "headerparameters" \[], "bodydataparameters" \[ { "kind" "required", "name" "customandquery", "type" "string", "description" "deprecated\n\nthe custom query you would like to fire, which klevu automatically converts into an appropriate query to be included with the request use a character before the parenthesis to exclude records matching the contained condition \n\nthis is advanced usage of our api and you may need some help with building these queries, so when you need support please reach out to us via the community forum " } ], "formdataparameters" \[] }, "results" { "languages" \[ { "id" "3xlvmt855lgkjoht0npxg", "code" "{\n \\"meta\\" {\n \\"qtime\\" 7,\n \\"responsecode\\" 200\n },\n \\"queryresults\\" \[\n {\n \\"id\\" \\"productsearch\\",\n \\"meta\\" {\n \\"qtime\\" 5,\n \\"noofresults\\" 10,\n \\"totalresultsfound\\" 209,\n \\"typeofsearch\\" \\"wildcard and\\",\n \\"offset\\" 0,\n \\"debugginginformation\\" {},\n \\"notificationcode\\" 1,\n \\"searchedterm\\" \\" \\",\n \\"apikey\\" \\"klevu 156925593843210765\\",\n \\"ispersonalised\\" false\n },\n \\"records\\" \[\n {\n \\"size\\" \\"small\\",\n \\"name\\" \\"stellar solar jacket\\",\n \\"id\\" \\"31366456541246\\",\n \\"brand\\" \\"ksd\\"\n },\n {\n \\"size\\" \\"small\\",\n \\"name\\" \\"lando gym jacket\\",\n \\"id\\" \\"31366487441470\\",\n \\"brand\\" \\"ksd\\"\n },\n {\n \\"size\\" \\"small\\",\n \\"name\\" \\"ingrid running jacket\\",\n \\"id\\" \\"31366455590974\\",\n \\"brand\\" \\"mnh\\"\n },\n {\n \\"size\\" \\"small\\",\n \\"name\\" \\"josie yoga jacket\\",\n \\"id\\" \\"31366456279102\\",\n \\"brand\\" \\"ksd\\"\n },\n {\n \\"size\\" \\"medium\\",\n \\"name\\" \\"hollister backyard sweatshirt\\",\n \\"id\\" \\"31366493438014\\",\n \\"brand\\" \\"mnh\\"\n },\n {\n \\"size\\" \\"medium\\",\n \\"name\\" \\"erika running short\\",\n \\"id\\" \\"31366431014974\\",\n \\"brand\\" \\"ksd\\"\n },\n {\n \\"size\\" \\"small\\",\n \\"name\\" \\"stellar solar jacket\\",\n \\"id\\" \\"31366456672318\\",\n \\"brand\\" \\"mnh\\"\n },\n {\n \\"size\\" \\"small\\",\n \\"name\\" \\"neve studio dance jacket\\",\n \\"id\\" \\"31366453461054\\",\n \\"brand\\" \\"mnh\\"\n },\n {\n \\"size\\" \\"small\\",\n \\"name\\" \\"augusta pullover jacket\\",\n \\"id\\" \\"31366455820350\\",\n \\"brand\\" \\"ksd\\"\n },\n {\n \\"size\\" \\"small\\",\n \\"name\\" \\"augusta pullover jacket\\",\n \\"id\\" \\"31366455951422\\",\n \\"brand\\" \\"mnh\\"\n }\n ],\n \\"filters\\" \[]\n }\n ]\n}", "language" "200", "customlabel" "" } ], "selectedlanguageid" "3xlvmt855lgkjoht0npxg" }, "examples" { "languages" \[ { "id" "jsu7dlyyj euh63ysp682", "code" "{\n \\"recordqueries\\" \[\n {\n \\"settings\\" {\n \\"customandquery\\" \\"(size \\\\\\"small\\\\\\" or size \\\\\\"medium\\\\\\") and (brand \\\\\\"kke\\\\\\")\\",\n \\"fields\\" \[\n \\"id\\",\n \\"name\\",\n \\"size\\",\n \\"brand\\"\n ],\n \\"limit\\" 10\n },\n \\"id\\" \\"productsearch\\"\n }\n ],\n \\"context\\" {\n \\"apikeys\\" \[\n \\"klevu 156925593843210765\\"\n ]\n }\n}", "language" "json", "customlabel" "request body (json)" }, { "id" "8yg33te4jzfowp5yebmjh", "code" "\<?php\n\n$curl = curl init();\n\ncurl setopt array($curl, array(\n curlopt url => 'https //eucs15v2 ksearchnet com/cs/v2/search',\n curlopt returntransfer => true,\n curlopt encoding => '',\n curlopt maxredirs => 10,\n curlopt timeout => 0,\n curlopt followlocation => true,\n curlopt http version => curl http version 1 1,\n curlopt customrequest => 'post',\n curlopt postfields =>'{\n \\"recordqueries\\" \[\n {\n \\"settings\\" {\n \\"customandquery\\" \\"(size \\\\\\\\\\"small\\\\\\\\\\" or size \\\\\\\\\\"medium\\\\\\\\\\") and (brand \\\\\\\\\\"kke\\\\\\\\\\")\\",\n \\"fields\\" \[\n \\"id\\",\n \\"name\\",\n \\"size\\",\n \\"brand\\"\n ],\n \\"limit\\" 10\n },\n \\"id\\" \\"productsearch\\"\n }\n ],\n \\"context\\" {\n \\"apikeys\\" \[\n \\"klevu 156925593843210765\\"\n ]\n }\n}',\n curlopt httpheader => array(\n 'content type application/json'\n ),\n));\n\n$response = curl exec($curl);\n\ncurl close($curl);\necho $response;\n", "language" "php", "customlabel" "" }, { "id" "wcdgtssqaxfiwklk2v174", "code" "var data = json stringify({\\"recordqueries\\" \[{\\"settings\\" {\\"customandquery\\" \\"(size \\\\\\"small\\\\\\" or size \\\\\\"medium\\\\\\") and (brand \\\\\\"kke\\\\\\")\\",\\"fields\\" \[\\"id\\",\\"name\\",\\"size\\",\\"brand\\"],\\"limit\\" 10},\\"id\\" \\"productsearch\\"}],\\"context\\" {\\"apikeys\\" \[\\"klevu 156925593843210765\\"]}});\n\nvar xhr = new xmlhttprequest();\nxhr withcredentials = false;\n\nxhr addeventlistener(\\"readystatechange\\", function() {\n if(this readystate === 4) {\n console log(this responsetext);\n }\n});\n\nxhr open(\\"post\\", \\"https //eucs15v2 ksearchnet com/cs/v2/search\\");\nxhr setrequestheader(\\"content type\\", \\"application/json\\");\n\nxhr send(data);", "language" "javascript", "customlabel" "" }, { "id" "npw0nije j5r9i5w4bgn0", "code" "okhttpclient client = new okhttpclient() newbuilder()\n build();\nmediatype mediatype = mediatype parse(\\"application/json\\");\nrequestbody body = requestbody create(mediatype, \\"{\\\n \\\\\\"recordqueries\\\\\\" \[\\\n {\\\n \\\\\\"settings\\\\\\" {\\\n \\\\\\"customandquery\\\\\\" \\\\\\"(size \\\\\\\\\\\\\\"small\\\\\\\\\\\\\\" or size \\\\\\\\\\\\\\"medium\\\\\\\\\\\\\\") and (brand \\\\\\\\\\\\\\"kke\\\\\\\\\\\\\\")\\\\\\",\\\n \\\\\\"fields\\\\\\" \[\\\n \\\\\\"id\\\\\\",\\\n \\\\\\"name\\\\\\",\\\n \\\\\\"size\\\\\\",\\\n \\\\\\"brand\\\\\\"\\\n ],\\\n \\\\\\"limit\\\\\\" 10\\\n },\\\n \\\\\\"id\\\\\\" \\\\\\"productsearch\\\\\\"\\\n }\\\n ],\\\n \\\\\\"context\\\\\\" {\\\n \\\\\\"apikeys\\\\\\" \[\\\n \\\\\\"klevu 156925593843210765\\\\\\"\\\n ]\\\n }\\\n}\\");\nrequest request = new request builder()\n url(\\"https //eucs15v2 ksearchnet com/cs/v2/search\\")\n method(\\"post\\", body)\n addheader(\\"content type\\", \\"application/json\\")\n build();\nresponse response = client newcall(request) execute();", "language" "java", "customlabel" "" }, { "id" "0ih7niekhhfml7cry51j ", "code" "var request = require('request');\nvar options = {\n 'method' 'post',\n 'url' 'https //eucs15v2 ksearchnet com/cs/v2/search',\n 'headers' {\n 'content type' 'application/json'\n },\n body json stringify({\\"recordqueries\\" \[{\\"settings\\" {\\"customandquery\\" \\"(size \\\\\\"small\\\\\\" or size \\\\\\"medium\\\\\\") and (brand \\\\\\"kke\\\\\\")\\",\\"fields\\" \[\\"id\\",\\"name\\",\\"size\\",\\"brand\\"],\\"limit\\" 10},\\"id\\" \\"productsearch\\"}],\\"context\\" {\\"apikeys\\" \[\\"klevu 156925593843210765\\"]}})\n\n};\nrequest(options, function (error, response) {\n if (error) throw new error(error);\n console log(response body);\n});\n", "language" "nodejs", "customlabel" "" } ], "selectedlanguageid" "wcdgtssqaxfiwklk2v174" }, "description" "this is an example how to merchandise search results using apis ", "currentnewparameter" { "label" "body parameter", "value" "bodydataparameters" } } try it here! multiple currencies if your store has multiple currencies and you would like to show different values based on the currency your customer is currently viewing, this can be achieved using the pricefieldsuffix parameter when specifying a value for pricefieldsuffix, the following fields in your response data will be replaced with the value indexed with klevu for the corresponding currency price saleprice currency { "tab" "examples", "url" "https //{{hostname}}/cs/v2/search", "name" "multi currency", "method" "post", "request" { "pathparameters" \[], "queryparameters" \[], "headerparameters" \[], "bodydataparameters" \[ { "kind" "required", "name" "pricefieldsuffix", "type" "string", "description" "if you have multiple currency support enabled for your store, this parameter can be used to retrieve prices for a specific currency for example, if the data you have indexed with klevu includes prices for a base currency gbp and an additional currency usd, a value of 'gbp' or 'usd' here will display the relevant currency values for your records " } ], "formdataparameters" \[] }, "results" { "languages" \[ { "id" "3xlvmt855lgkjoht0npxg", "code" "{\n \\"meta\\" {\n \\"qtime\\" 7,\n \\"responsecode\\" 200\n },\n \\"queryresults\\" \[\n {\n \\"id\\" \\"productsearch\\",\n \\"meta\\" {\n \\"qtime\\" 5,\n \\"noofresults\\" 1,\n \\"totalresultsfound\\" 104,\n \\"typeofsearch\\" \\"wildcard and\\",\n \\"offset\\" 0,\n \\"debugginginformation\\" {},\n \\"notificationcode\\" 2,\n \\"searchedterm\\" \\"short\\",\n \\"apikey\\" \\"klevu 156925593843210765\\",\n \\"ispersonalised\\" false\n },\n \\"records\\" \[\n {\n \\"storebasecurrency\\" \\"gbp\\",\n \\"saleprice\\" \\"45 00\\",\n \\"price\\" \\"45 00\\",\n \\"name\\" \\"erika running short\\",\n \\"currency\\" \\"gbp\\",\n \\"id\\" \\"31366431146046\\"\n }\n ],\n \\"filters\\" \[]\n }\n ]\n}", "language" "200", "customlabel" "" } ], "selectedlanguageid" "3xlvmt855lgkjoht0npxg" }, "examples" { "languages" \[ { "id" "jsu7dlyyj euh63ysp682", "code" "{\n \\"recordqueries\\" \[\n {\n \\"settings\\" {\n \\"pricefieldsuffix\\" \\"usd\\",\n \\"query\\" {\n \\"term\\" \\"short\\"\n },\n \\"fields\\" \[\n \\"id\\",\n \\"name\\",\n \\"price\\",\n \\"saleprice\\",\n \\"currency\\",\n \\"storecurrency\\"\n ],\n \\"limit\\" 1,\n \\"typeofrecords\\" \[\n \\"klevu product\\"\n ]\n },\n \\"id\\" \\"productsearch\\"\n }\n ],\n \\"context\\" {\n \\"apikeys\\" \[\n \\"klevu 156925593843210765\\"\n ]\n }\n}", "language" "json", "customlabel" "request body (json)" }, { "id" "8yg33te4jzfowp5yebmjh", "code" "\<?php\n\n$curl = curl init();\n\ncurl setopt array($curl, array(\n curlopt url => 'https //eucs15v2 ksearchnet com/cs/v2/search',\n curlopt returntransfer => true,\n curlopt encoding => '',\n curlopt maxredirs => 10,\n curlopt timeout => 0,\n curlopt followlocation => true,\n curlopt http version => curl http version 1 1,\n curlopt customrequest => 'post',\n curlopt postfields =>'{\n \\"recordqueries\\" \[\n {\n \\"settings\\" {\n \\"pricefieldsuffix\\" \\"usd\\",\n \\"query\\" {\n \\"term\\" \\"short\\"\n },\n \\"fields\\" \[\n \\"id\\",\n \\"name\\",\n \\"price\\",\n \\"saleprice\\",\n \\"currency\\",\n \\"storecurrency\\"\n ],\n \\"limit\\" 1,\n \\"typeofrecords\\" \[\n \\"klevu product\\"\n ]\n },\n \\"id\\" \\"productsearch\\"\n }\n ],\n \\"context\\" {\n \\"apikeys\\" \[\n \\"klevu 156925593843210765\\"\n ]\n }\n}',\n curlopt httpheader => array(\n 'content type application/json'\n ),\n));\n\n$response = curl exec($curl);\n\ncurl close($curl);\necho $response;\n", "language" "php", "customlabel" "" }, { "id" "wcdgtssqaxfiwklk2v174", "code" "var data = json stringify({\\"recordqueries\\" \[{\\"settings\\" {\\"pricefieldsuffix\\" \\"usd\\",\\"query\\" {\\"term\\" \\"short\\"},\\"fields\\" \[\\"id\\",\\"name\\",\\"price\\",\\"saleprice\\",\\"currency\\",\\"storecurrency\\"],\\"limit\\" 1,\\"typeofrecords\\" \[\\"klevu product\\"]},\\"id\\" \\"productsearch\\"}],\\"context\\" {\\"apikeys\\" \[\\"klevu 156925593843210765\\"]}});\n\nvar xhr = new xmlhttprequest();\nxhr withcredentials = false;\n\nxhr addeventlistener(\\"readystatechange\\", function() {\n if(this readystate === 4) {\n console log(this responsetext);\n }\n});\n\nxhr open(\\"post\\", \\"https //eucs15v2 ksearchnet com/cs/v2/search\\");\nxhr setrequestheader(\\"content type\\", \\"application/json\\");\n\nxhr send(data);", "language" "javascript", "customlabel" "" }, { "id" "npw0nije j5r9i5w4bgn0", "code" "okhttpclient client = new okhttpclient() newbuilder()\n build();\nmediatype mediatype = mediatype parse(\\"application/json\\");\nrequestbody body = requestbody create(mediatype, \\"{\\\n \\\\\\"recordqueries\\\\\\" \[\\\n {\\\n \\\\\\"settings\\\\\\" {\\\n \\\\\\"pricefieldsuffix\\\\\\" \\\\\\"usd\\\\\\",\\\n \\\\\\"query\\\\\\" {\\\n \\\\\\"term\\\\\\" \\\\\\"short\\\\\\"\\\n },\\\n \\\\\\"fields\\\\\\" \[\\\n \\\\\\"id\\\\\\",\\\n \\\\\\"name\\\\\\",\\\n \\\\\\"price\\\\\\",\\\n \\\\\\"saleprice\\\\\\",\\\n \\\\\\"currency\\\\\\",\\\n \\\\\\"storecurrency\\\\\\"\\\n ],\\\n \\\\\\"limit\\\\\\" 1,\\\n \\\\\\"typeofrecords\\\\\\" \[\\\n \\\\\\"klevu product\\\\\\"\\\n ]\\\n },\\\n \\\\\\"id\\\\\\" \\\\\\"productsearch\\\\\\"\\\n }\\\n ],\\\n \\\\\\"context\\\\\\" {\\\n \\\\\\"apikeys\\\\\\" \[\\\n \\\\\\"klevu 156925593843210765\\\\\\"\\\n ]\\\n }\\\n}\\");\nrequest request = new request builder()\n url(\\"https //eucs15v2 ksearchnet com/cs/v2/search\\")\n method(\\"post\\", body)\n addheader(\\"content type\\", \\"application/json\\")\n build();\nresponse response = client newcall(request) execute();", "language" "java", "customlabel" "" }, { "id" "0ih7niekhhfml7cry51j ", "code" "var request = require('request');\nvar options = {\n 'method' 'post',\n 'url' 'https //eucs15v2 ksearchnet com/cs/v2/search',\n 'headers' {\n 'content type' 'application/json'\n },\n body json stringify({\\"recordqueries\\" \[{\\"settings\\" {\\"pricefieldsuffix\\" \\"usd\\",\\"query\\" {\\"term\\" \\"short\\"},\\"fields\\" \[\\"id\\",\\"name\\",\\"price\\",\\"saleprice\\",\\"currency\\",\\"storecurrency\\"],\\"limit\\" 1,\\"typeofrecords\\" \[\\"klevu product\\"]},\\"id\\" \\"productsearch\\"}],\\"context\\" {\\"apikeys\\" \[\\"klevu 156925593843210765\\"]}})\n\n};\nrequest(options, function (error, response) {\n if (error) throw new error(error);\n console log(response body);\n});\n", "language" "nodejs", "customlabel" "" } ], "selectedlanguageid" "wcdgtssqaxfiwklk2v174" }, "description" "this is an example how to fetch prices for specific currency ", "currentnewparameter" { "label" "body parameter", "value" "bodydataparameters" } } try it here! customer groups a common b2b requirement is different product visibility and prices based on a customer group with klevu apiv2 you can specify parameters to filter out products which a particular customer should not see, and also show them specific prices if they differ from the base price when specifying a value for pricefieldsuffix, the following fields in your response data will be replaced with the value indexed with klevu for the corresponding currency and group price saleprice currency when specifying a value for visibilitygroupid, any records that do not belong to that group will be excluded from the results in the example to the right, the same product is indexed with data for currencies 'gbp' and 'usd' it's visibility is set to groups 'my group 1' and 'my group 3', but not 'my group 2' { "tab" "examples", "url" "https //{{hostname}}/cs/v2/search", "name" "customer groups", "method" "post", "request" { "pathparameters" \[], "queryparameters" \[], "headerparameters" \[], "bodydataparameters" \[ { "kind" "required", "name" "pricefieldsuffix", "type" "string", "description" "if you have provided different prices for different groups when indexing your store data with klevu, you can fetch those prices specific to a particular group \n\nthe format of this parameter is {currency} {groupid} for example if the currency you require is usd and your indexed group id is 'my group 1', your query should include \\"pricefieldsuffix\\" \\"usd my group 1\\" " }, { "kind" "optional", "name" "visibilitygroupid ", "type" "string", "description" "if you have provided visibility data for each record when indexing your store data with klevu, you can specify an id of that group here to exclude all records which do not belong \n\nthe format of this parameter is {groupid} for example if your indexed group id is 'my group 1', your query should include \\"visibilitygroupid\\" \\"my group 1\\" " } ], "formdataparameters" \[] }, "results" { "languages" \[ { "id" "3xlvmt855lgkjoht0npxg", "code" "{\n \\"meta\\" {\n \\"qtime\\" 33,\n \\"responsecode\\" 200\n },\n \\"queryresults\\" \[\n {\n \\"id\\" \\"productsearch\\",\n \\"meta\\" {\n \\"qtime\\" 31,\n \\"noofresults\\" 1,\n \\"totalresultsfound\\" 0,\n \\"typeofsearch\\" \\"fuzzy or\\",\n \\"offset\\" 0,\n \\"debugginginformation\\" {},\n \\"notificationcode\\" 1,\n \\"searchedterm\\" \\"short\\",\n \\"apikey\\" \\"klevu 156925593843210765\\",\n \\"ispersonalised\\" false\n },\n \\"records\\" \[],\n \\"filters\\" \[]\n }\n ]\n}", "language" "200", "customlabel" "" } ], "selectedlanguageid" "3xlvmt855lgkjoht0npxg" }, "examples" { "languages" \[ { "id" "jsu7dlyyj euh63ysp682", "code" "{\n \\"recordqueries\\" \[\n {\n \\"id\\" \\"productsearch\\",\n \\"typeofrequest\\" \\"search\\",\n \\"settings\\" {\n \\"pricefieldsuffix\\" \\"usd my group 3\\",\n \\"visibilitygroupid\\" \\"my group 3\\",\n \\"query\\" {\n \\"term\\" \\"short\\"\n },\n \\"fields\\" \[\n \\"id\\",\n \\"name\\",\n \\"price\\",\n \\"saleprice\\",\n \\"currency\\",\n \\"storecurrency\\"\n ],\n \\"limit\\" 1,\n \\"typeofrecords\\" \[\n \\"klevu product\\"\n ]\n }\n }\n ],\n \\"context\\" {\n \\"apikeys\\" \[\n \\"klevu 156925593843210765\\"\n ]\n }\n}", "language" "json", "customlabel" "request body (json)" }, { "id" "8yg33te4jzfowp5yebmjh", "code" "\<?php\n\n$curl = curl init();\n\ncurl setopt array($curl, array(\n curlopt url => 'https //eucs15v2 ksearchnet com/cs/v2/search',\n curlopt returntransfer => true,\n curlopt encoding => '',\n curlopt maxredirs => 10,\n curlopt timeout => 0,\n curlopt followlocation => true,\n curlopt http version => curl http version 1 1,\n curlopt customrequest => 'post',\n curlopt postfields =>'{\n \\"recordqueries\\" \[\n {\n \\"id\\" \\"productsearch\\",\n \\"typeofrequest\\" \\"search\\",\n \\"settings\\" {\n \\"pricefieldsuffix\\" \\"usd my group 3\\",\n \\"visibilitygroupid\\" \\"my group 3\\",\n \\"query\\" {\n \\"term\\" \\"short\\"\n },\n \\"fields\\" \[\n \\"id\\",\n \\"name\\",\n \\"price\\",\n \\"saleprice\\",\n \\"currency\\",\n \\"storecurrency\\"\n ],\n \\"limit\\" 1,\n \\"typeofrecords\\" \[\n \\"klevu product\\"\n ]\n }\n }\n ],\n \\"context\\" {\n \\"apikeys\\" \[\n \\"klevu 156925593843210765\\"\n ]\n }\n}',\n curlopt httpheader => array(\n 'content type application/json'\n ),\n));\n\n$response = curl exec($curl);\n\ncurl close($curl);\necho $response;\n", "language" "php", "customlabel" "" }, { "id" "wcdgtssqaxfiwklk2v174", "code" "var data = json stringify({\\"recordqueries\\" \[{\\"id\\" \\"productsearch\\",\\"typeofrequest\\" \\"search\\",\\"settings\\" {\\"pricefieldsuffix\\" \\"usd my group 3\\",\\"visibilitygroupid\\" \\"my group 3\\",\\"query\\" {\\"term\\" \\"short\\"},\\"fields\\" \[\\"id\\",\\"name\\",\\"price\\",\\"saleprice\\",\\"currency\\",\\"storecurrency\\"],\\"limit\\" 1,\\"typeofrecords\\" \[\\"klevu product\\"]}}],\\"context\\" {\\"apikeys\\" \[\\"klevu 156925593843210765\\"]}});\n\nvar xhr = new xmlhttprequest();\nxhr withcredentials = false;\n\nxhr addeventlistener(\\"readystatechange\\", function() {\n if(this readystate === 4) {\n console log(this responsetext);\n }\n});\n\nxhr open(\\"post\\", \\"https //eucs15v2 ksearchnet com/cs/v2/search\\");\nxhr setrequestheader(\\"content type\\", \\"application/json\\");\n\nxhr send(data);", "language" "javascript", "customlabel" "" }, { "id" "npw0nije j5r9i5w4bgn0", "code" "okhttpclient client = new okhttpclient() newbuilder()\n build();\nmediatype mediatype = mediatype parse(\\"application/json\\");\nrequestbody body = requestbody create(mediatype, \\"{\\\n \\\\\\"recordqueries\\\\\\" \[\\\n {\\\n \\\\\\"id\\\\\\" \\\\\\"productsearch\\\\\\",\\\n \\\\\\"typeofrequest\\\\\\" \\\\\\"search\\\\\\",\\\n \\\\\\"settings\\\\\\" {\\\n \\\\\\"pricefieldsuffix\\\\\\" \\\\\\"usd my group 3\\\\\\",\\\n \\\\\\"visibilitygroupid\\\\\\" \\\\\\"my group 3\\\\\\",\\\n \\\\\\"query\\\\\\" {\\\n \\\\\\"term\\\\\\" \\\\\\"short\\\\\\"\\\n },\\\n \\\\\\"fields\\\\\\" \[\\\n \\\\\\"id\\\\\\",\\\n \\\\\\"name\\\\\\",\\\n \\\\\\"price\\\\\\",\\\n \\\\\\"saleprice\\\\\\",\\\n \\\\\\"currency\\\\\\",\\\n \\\\\\"storecurrency\\\\\\"\\\n ],\\\n \\\\\\"limit\\\\\\" 1,\\\n \\\\\\"typeofrecords\\\\\\" \[\\\n \\\\\\"klevu product\\\\\\"\\\n ]\\\n }\\\n }\\\n ],\\\n \\\\\\"context\\\\\\" {\\\n \\\\\\"apikeys\\\\\\" \[\\\n \\\\\\"klevu 156925593843210765\\\\\\"\\\n ]\\\n }\\\n}\\");\nrequest request = new request builder()\n url(\\"https //eucs15v2 ksearchnet com/cs/v2/search\\")\n method(\\"post\\", body)\n addheader(\\"content type\\", \\"application/json\\")\n build();\nresponse response = client newcall(request) execute();", "language" "java", "customlabel" "" }, { "id" "0ih7niekhhfml7cry51j ", "code" "var request = require('request');\nvar options = {\n 'method' 'post',\n 'url' 'https //eucs15v2 ksearchnet com/cs/v2/search',\n 'headers' {\n 'content type' 'application/json'\n },\n body json stringify({\\"recordqueries\\" \[{\\"id\\" \\"productsearch\\",\\"typeofrequest\\" \\"search\\",\\"settings\\" {\\"pricefieldsuffix\\" \\"usd my group 3\\",\\"visibilitygroupid\\" \\"my group 3\\",\\"query\\" {\\"term\\" \\"short\\"},\\"fields\\" \[\\"id\\",\\"name\\",\\"price\\",\\"saleprice\\",\\"currency\\",\\"storecurrency\\"],\\"limit\\" 1,\\"typeofrecords\\" \[\\"klevu product\\"]}}],\\"context\\" {\\"apikeys\\" \[\\"klevu 156925593843210765\\"]}})\n\n};\nrequest(options, function (error, response) {\n if (error) throw new error(error);\n console log(response body);\n});\n", "language" "nodejs", "customlabel" "" } ], "selectedlanguageid" "wcdgtssqaxfiwklk2v174" }, "description" "this is an example how to fetch prices specific to customer groups ", "currentnewparameter" { "label" "body parameter", "value" "bodydataparameters" } } try it here