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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...