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!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...