<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How can we delete particular data from KVStore using REST API/ CURL without using _key? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-can-we-delete-particular-data-from-KVStore-using-REST-API/m-p/478165#M82077</link>
    <description>&lt;P&gt;Here, the requirement is to delete all the data from KVStore having the particular KVStore filed value.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Example:&lt;/STRONG&gt; I have a KVStore for student data with Name, Std, roll_number.&lt;/P&gt;

&lt;P&gt;In my KVStore, I have all the student information across all the standards. &lt;/P&gt;

&lt;P&gt;So my use cases re,&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;If I want to delete all the records of 10th standard's students then how can I do using REST API&lt;/LI&gt;
&lt;LI&gt;If I want to delete all the records of 5th to 10th standard's students then how can I do using REST API.&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;You can create as many use cases as you think. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;</description>
    <pubDate>Mon, 20 Apr 2020 05:33:08 GMT</pubDate>
    <dc:creator>kamlesh_vaghela</dc:creator>
    <dc:date>2020-04-20T05:33:08Z</dc:date>
    <item>
      <title>How can we delete particular data from KVStore using REST API/ CURL without using _key?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-we-delete-particular-data-from-KVStore-using-REST-API/m-p/478165#M82077</link>
      <description>&lt;P&gt;Here, the requirement is to delete all the data from KVStore having the particular KVStore filed value.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Example:&lt;/STRONG&gt; I have a KVStore for student data with Name, Std, roll_number.&lt;/P&gt;

&lt;P&gt;In my KVStore, I have all the student information across all the standards. &lt;/P&gt;

&lt;P&gt;So my use cases re,&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;If I want to delete all the records of 10th standard's students then how can I do using REST API&lt;/LI&gt;
&lt;LI&gt;If I want to delete all the records of 5th to 10th standard's students then how can I do using REST API.&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;You can create as many use cases as you think. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2020 05:33:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-we-delete-particular-data-from-KVStore-using-REST-API/m-p/478165#M82077</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2020-04-20T05:33:08Z</dc:date>
    </item>
    <item>
      <title>Re: How can we delete particular data from KVStore using REST API/ CURL without using _key?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-we-delete-particular-data-from-KVStore-using-REST-API/m-p/478166#M82078</link>
      <description>&lt;P&gt;By using below options, you can delete all the records from specific collection OR delete specific records from specific collection using &lt;CODE&gt;_key&lt;/CODE&gt; ID. Let's see all the ways of deleting records using CURL.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;1) Delete all records in the "kvstorecoll" collection:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -k -u admin:yourpassword -X DELETE &lt;A href="https://localhost:8089/servicesNS/nobody/kvstoretest/storage/collections/data/kvstorecoll" target="test_blank"&gt;https://localhost:8089/servicesNS/nobody/kvstoretest/storage/collections/data/kvstorecoll&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;2) Delete the record with the key ID " 5410be5441ba15298e4624d1":&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -k -u admin:yourpassword -X DELETE &lt;A href="https://localhost:8089/servicesNS/nobody/kvstoretest/storage/collections/data/kvstorecoll/5410be5441ba15298e4624d1" target="test_blank"&gt;https://localhost:8089/servicesNS/nobody/kvstoretest/storage/collections/data/kvstorecoll/5410be5441ba15298e4624d1&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can find the above curl commands in &lt;A href="https://dev.splunk.com/enterprise/docs/developapps/kvstore/"&gt;https://dev.splunk.com/enterprise/docs/developapps/kvstore/&lt;/A&gt; documentation.&lt;/P&gt;

&lt;P&gt;As per our requirement, we need to delete specific records.&lt;/P&gt;

&lt;P&gt;For deleting specific records, we have to use query parameters in our REST/CURL.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;3) Delete the records with the Standard value 10&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -k -u admin:admin123 &lt;A href="https://localhost:8089/servicesNS/nobody/test/storage/collections/data/kvstorecoll\?query\=\{\&amp;quot;std\&amp;quot;:10\}" target="test_blank"&gt;https://localhost:8089/servicesNS/nobody/test/storage/collections/data/kvstorecoll\?query\=\{\"std\":10\}&lt;/A&gt; -g -X DELETE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;4) Delete the records with the Standard value from 5 to 10&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -k -u admin:admin123 https://localhost:8089/servicesNS/nobody/test/storage/collections/data/kvstorecoll\?query\=\{\"\$and\":\[\{\"std\":\{\"\$gt\":4\}\},\{\"id\":\{\"$lt\":11\}\}\]\} -g -X DELETE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Note:&lt;/STRONG&gt; In case, any REST/CURL not working as expected then make sure your query parameter value which should be encoded with the &lt;CODE&gt;%&lt;/CODE&gt; encoding.&lt;/P&gt;

&lt;P&gt;My 4th example doesn't work properly for me for a few cases. So converted it into % encoding and It works like charm.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Updated 4)&lt;/STRONG&gt; &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -k -u admin:admin123 &lt;A href="https://localhost:8089/servicesNS/nobody/test/storage/collections/data/kvstorecoll\?query=%7B%20%22%24and%22%3A%20%5B%20%7B%20%22id%22%3A%20%7B%20%22%24gt%22%3A%205%20%7D%20%7D%2C%20%7B%20%22id%22%3A%20%7B%20%22%24lt%22%3A%2013%20%7D%20%7D%20%5D%20%7D%0A" target="test_blank"&gt;https://localhost:8089/servicesNS/nobody/test/storage/collections/data/kvstorecoll\?query=%7B%20%22%24and%22%3A%20%5B%20%7B%20%22id%22%3A%20%7B%20%22%24gt%22%3A%205%20%7D%20%7D%2C%20%7B%20%22id%22%3A%20%7B%20%22%24lt%22%3A%2013%20%7D%20%7D%20%5D%20%7D%0A&lt;/A&gt; -g -X DELETE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can find more about the query parameters and operators in the below docs.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/RESTREF/RESTkvstore"&gt;https://docs.splunk.com/Documentation/Splunk/latest/RESTREF/RESTkvstore&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Happy Splunking&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2020 05:35:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-we-delete-particular-data-from-KVStore-using-REST-API/m-p/478166#M82078</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2020-04-20T05:35:22Z</dc:date>
    </item>
    <item>
      <title>Re: How can we delete particular data from KVStore using REST API/ CURL without using _key?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-we-delete-particular-data-from-KVStore-using-REST-API/m-p/478167#M82079</link>
      <description>&lt;P&gt;There are a couple of apps out there that give you a curl SPL command too...  you could in theory do this from splunk search.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2020 11:27:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-we-delete-particular-data-from-KVStore-using-REST-API/m-p/478167#M82079</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2020-04-20T11:27:35Z</dc:date>
    </item>
  </channel>
</rss>

