Skip to content

Instantly share code, notes, and snippets.

@ilyaresh
Last active March 17, 2019 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilyaresh/0d15b73229771fd0315e1f7e5954ae5e to your computer and use it in GitHub Desktop.
Save ilyaresh/0d15b73229771fd0315e1f7e5954ae5e to your computer and use it in GitHub Desktop.
Postman export with the commands required to manage Splunk KV Store using REST part of http://isbyr.com/manage-splunk-kv-store-using-rest-api/
{
"info": {
"_postman_id": "3317c68b-6a5d-44ee-851c-f5d999ca1a20",
"name": "Splunk",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "KVStore - Add Item",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "mypass",
"type": "string"
},
{
"key": "username",
"value": "me",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": " {\n \"def_id\": 1105,\n \"earliest_time\": 1551668400,\n \"schedule_time\": 1551672000,\n \"sla_id\": \"1105_1551672000\",\n \"sla_status\": 0,\n \"_key\": \"1105_1551672000\"\n }"
},
"url": {
"raw": "https://SPLUNK_SH:8089/servicesNS/nobody/KVSTORE_COLL/storage/collections/data/KVSTORE_COLL",
"protocol": "https",
"host": [
"SPLUNK_SH"
],
"port": "8089",
"path": [
"servicesNS",
"nobody",
"KVSTORE_COLL",
"storage",
"collections",
"data",
"KVSTORE_COLL"
]
}
},
"response": []
},
{
"name": "KVStore - Configure Collection",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "mypass",
"type": "string"
},
{
"key": "username",
"value": "me",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/x-www-form-urlencoded",
"type": "text"
}
],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "enforceTypes",
"value": "true",
"type": "text"
},
{
"key": "field.def_id",
"value": "number",
"type": "text"
},
{
"key": "field.scheduled_time",
"value": "time",
"type": "text"
},
{
"key": "field.earliest_time",
"value": "time",
"type": "text"
},
{
"key": "field.latest_time",
"value": "time",
"type": "text"
},
{
"key": "field.sla_status",
"value": "number",
"type": "text"
}
]
},
"url": {
"raw": "https://SPLUNK_SH:8089/servicesNS/nobody/KVSTORE_COLL/storage/collections/config/KVSTORE_COLL",
"protocol": "https",
"host": [
"SPLUNK_SH"
],
"port": "8089",
"path": [
"servicesNS",
"nobody",
"KVSTORE_COLL",
"storage",
"collections",
"config",
"KVSTORE_COLL"
]
}
},
"response": []
},
{
"name": "KVStore - Create New Collection",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "mypass",
"type": "string"
},
{
"key": "username",
"value": "me",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/x-www-form-urlencoded"
}
],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "name",
"value": "KVSTORE_COLL",
"type": "text"
}
]
},
"url": {
"raw": "https://SPLUNK_SH:8089/servicesNS/nobody/KVSTORE_COLL/storage/collections/config/",
"protocol": "https",
"host": [
"SPLUNK_SH"
],
"port": "8089",
"path": [
"servicesNS",
"nobody",
"KVSTORE_COLL",
"storage",
"collections",
"config",
""
]
}
},
"response": []
},
{
"name": "KVStore - Get All Items",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "keonig10",
"type": "string"
},
{
"key": "username",
"value": "admin",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"sla_id\" : 5,\n\t\"def_id\" : 1,\n\t\"schedule_time\" : 1551304508,\n\t\"earliest_time\" : 1551304208\n}"
},
"url": {
"raw": "https://SPLUNK_SH:8089/servicesNS/nobody/search/storage/collections/data/KVSTORE_COLL",
"protocol": "https",
"host": [
"SPLUNK_SH"
],
"port": "8089",
"path": [
"servicesNS",
"nobody",
"search",
"storage",
"collections",
"data",
"KVSTORE_COLL"
]
}
},
"response": []
},
{
"name": "KVStore - Update Item",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "mypass",
"type": "string"
},
{
"key": "username",
"value": "me",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": " {\n \"def_id\": 1032,\n \"earliest_time\": 1552260500,\n \"schedule_time\": 1552269600,\n \"sla_status\": 0,\n \"_key\": \"1032_1552270500\"\n }"
},
"url": {
"raw": "https://SPLUNK_SH:8089/servicesNS/nobody/KVSTORE_COLL/storage/collections/data/KVSTORE_COLL/1032_1552270500",
"protocol": "https",
"host": [
"SPLUNK_SH"
],
"port": "8089",
"path": [
"servicesNS",
"nobody",
"KVSTORE_COLL",
"storage",
"collections",
"data",
"KVSTORE_COLL",
"1032_1552270500"
]
}
},
"response": []
},
{
"name": "KVStore - Get Single Item",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "mypass",
"type": "string"
},
{
"key": "username",
"value": "me",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://SPLUNK_SH:8089/servicesNS/nobody/KVSTORE_COLL/storage/collections/data/KVSTORE_COLL/1032_1552270500",
"protocol": "https",
"host": [
"SPLUNK_SH"
],
"port": "8089",
"path": [
"servicesNS",
"nobody",
"KVSTORE_COLL",
"storage",
"collections",
"data",
"KVSTORE_COLL",
"1032_1552270500"
]
}
},
"response": []
},
{
"name": "KVStore - Get Items with query",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "mypass",
"type": "string"
},
{
"key": "username",
"value": "me",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://SPLUNK_SH:8089/servicesNS/nobody/KVSTORE_COLL/storage/collections/data/KVSTORE_COLL?query={ \"$and\": [{\"def_id\":{\"$gt\":1049}},{\"def_id\":{\"$lt\":1060}},{\"sla_status\":\"0\"}]}",
"protocol": "https",
"host": [
"SPLUNK_SH"
],
"port": "8089",
"path": [
"servicesNS",
"nobody",
"KVSTORE_COLL",
"storage",
"collections",
"data",
"KVSTORE_COLL"
],
"query": [
{
"key": "query",
"value": "{ \"$and\": [{\"def_id\":{\"$gt\":1049}},{\"def_id\":{\"$lt\":1060}},{\"sla_status\":\"0\"}]}"
}
]
}
},
"response": []
},
{
"name": "KVStore - DELETE Items with query",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "mypass",
"type": "string"
},
{
"key": "username",
"value": "me",
"type": "string"
}
]
},
"method": "DELETE",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://SPLUNK_SH:8089/servicesNS/nobody/KVSTORE_COLL/storage/collections/data/KVSTORE_COLL?query={\"earliest_time\":{\"$lt\":1551877200}}",
"protocol": "https",
"host": [
"SPLUNK_SH"
],
"port": "8089",
"path": [
"servicesNS",
"nobody",
"KVSTORE_COLL",
"storage",
"collections",
"data",
"KVSTORE_COLL"
],
"query": [
{
"key": "query",
"value": "{\"earliest_time\":{\"$lt\":1551877200}}"
}
]
}
},
"response": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment