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!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...