Getting Data In

Setting tag values through REST API

spbayer
Engager

Is it possible create tags and set tag values through the REST API?

Tags (2)

Ledion_Bitincka
Splunk Employee
Splunk Employee

Yes it is possible, this not publicly documented however this is how the UI adds/deletes fields from the search view

POST /servicesNS/<user>/<app>/search/fields/<field-name>/tags "value=ValueToTagHere&add=tag1&add=tag2&delete=tag3&delete=tag4"

You can have as many add and delete tags as you wish in your POST

asdfasdf12321
Explorer

It's also possible to remove tags more globally with something like:

curl -u admin:changeme -k https://localhost:8089/servicesNS/admin/<app>/search/tags/<tag-name>; -d "delete"

Or the curl equivient of the above answer is:

curl -u admin:changeme -k https://localhost:8089/servicesNS/admin/<app>/search/fields/<field-name>/tags  -d"value=ValueToTagHere&add=tag1&add=tag2&delete=tag3&delete=tag4"
0 Karma

asdfasdf12321
Explorer

The tagger app appears to use this undocumented API.

0 Karma

ma_anand1984
Contributor

@Ledion Bitincka
I dont understand, we usually access tags like | rest splunk_server=local /servicesNS/-/-/search/fields/{field name}/tags

how to user POST is it like "| POST "or "| rest POST". Can you give full command?

0 Karma

gkanapathy
Splunk Employee
Splunk Employee

It is theoretically possible. In general, anything you can do via the UI can be done via the REST API, since the UI uses the REST API to do all Splunk server and object manipulations. However, in practice, not all object manipulations are currently published.

0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...