Splunk Dev

Add user with python SDK

maurelio79
Communicator

Hi, i'm learning Python SDK and i'm try to create a new user, with this code:

users = service.users
new_user = users.create("my user", "empty password", roles="basic_user", type="Splunk")

but i get this error:

raise HTTPError(response)
splunklib.binding.HTTPError: HTTP 400 Bad Request --
In handler 'users': Argument "type" is not supported by this handler.

How to pass the auth type to the class Users? i try in different way, but no one works.

In general, when in api reference i found something like this:

params (dict) – Additional arguments (optional). For a list of available parameters, see User authentication parameters on Splunk Developer Portal.

In which format i have to pass param?

Thanks in advance and regards.

P.S.

I'm trying also:

users = service.users
kwargs = {"type": "Splunk"}
new_user = users.create("wu", "test", roles="user", **kwargs)

But i get the same error

P.P.S.

Ok, this last method is correct, i tried with

kwargs = {"realname": "Some Name"}

and it works. So how can i pass the authetication method to this class?

0 Karma
1 Solution

paramagurukarth
Builder

You can set values only for the following fields

defaultApp
email
force-change-pass
password
realname
restart_background_jobs
roles
tz

View solution in original post

paramagurukarth
Builder

You can set values only for the following fields

defaultApp
email
force-change-pass
password
realname
restart_background_jobs
roles
tz
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 ...