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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...