Splunk Search

How to execute macro search with REST API

pravinvram
Engager

How do i execute macros in rest API , example :

curl -ku user:pass https://<url> -d search="`macro name` | table data1 data2"

Labels (1)
Tags (2)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Escape the backticks.

curl -ku user:pass https://<url> -d search="\`macro name\` | table data1 data2"
---
If this reply helps you, Karma would be appreciated.
0 Karma

pravinvram
Engager

@richgalloway  - thanks for the details , tired that as well however receiving below error.

I own the macro and there is full permission read , still getting this error

<?xml version="1.0" encoding="UTF-8"?>
<response>
<messages>
<msg type="FATAL">User  could not act as: admin</msg>
</messages>
</response>

0 Karma

richgalloway
SplunkTrust
SplunkTrust

It looks like the macro is trying to execute, but the content requires permissions you don't have.  What are the search and macro trying to do?

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...