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!

How to Monitor Google Kubernetes Engine (GKE)

We’ve looked at how to integrate Kubernetes environments with Splunk Observability Cloud, but what about ...

Index This | How can you make 45 using only 4?

October 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...

Splunk Education Goes to Washington | Splunk GovSummit 2024

If you’re in the Washington, D.C. area, this is your opportunity to take your career and Splunk skills to the ...