Splunk Dev

Why can the Splunk Python SDK add macros NAME and Definition but the Sharing and the Owner doesn't apply?

jadengoho
Builder

I do have a code like this
service.post('/servicesNS/nobody/search/admin/macros/'+name,definition= "sample definition " ,sharing="global",owner="ME")

It can add macros NAME and Definition but the Sharing and the Owner doesn't apply.
How can I possibly do this?

Thanks in advance

0 Karma
1 Solution

jadengoho
Builder

I already answer this question .
1) your app must be on GLOBAL first , it conflict some of the code if it is set as app
2) And put this code :

service.post('properties/macros',__stanza=name,sharing="global",app='appname',owner='admin')
service.post('properties/macros/'+name,definition=val)

By this code i done the task

View solution in original post

0 Karma

jadengoho
Builder

I already answer this question .
1) your app must be on GLOBAL first , it conflict some of the code if it is set as app
2) And put this code :

service.post('properties/macros',__stanza=name,sharing="global",app='appname',owner='admin')
service.post('properties/macros/'+name,definition=val)

By this code i done the task

0 Karma

jadengoho
Builder

I already answer this question .
1) your app must be on GLOBAL first , it conflict some of the code if it is set as app
2) And put this code :

service.post('properties/macros',__stanza=name,sharing="global",app='appname',owner='admin')
service.post('properties/macros/'+name,definition=val)

By this code i done the task

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...