Solved

Setting user attribute using Looker API

  • 6 September 2021
  • 1 reply
  • 36 views

Is it possible to set user attributes using API method

sdk.set_user_attribute_user_value(user_id=10, user_attribute_id=1, body=models.WriteUserAttributeWithValue(value='value'))?

I have multiple realms and I want to do some actions in a loop changing some user attribute (realm in my case) but have this error:

looker_sdk.error.SDKError: {"message":"Setting system-level user attributes is not permitted.","documentation_url":"http://docs.looker.com/"}
Thanks!

 

icon

Best answer by Lan 14 September 2021, 05:39

first_name First Name System setting
last_name Last Name System setting
email Email System setting
name Full Name System setting
timezone Timezone System setting
id Looker User ID System setting
ldap_user_id LDAP External User ID System setting
saml_user_id Saml External User ID System setting
google_user_id Google Auth External User ID System setting
oidc_user_id OpenID Connect External User ID System setting

 

We can not edit Looker’s system-level attributes (listed in the table above). 

In your example call, `user_attribute_id = 1` is being used. I used `get/user_attributes` to see which attribute this id refers to, and confirm that it refers to “first_name”.

If the intention is to change users’ first name, you could use `sdk.update_user()`. Otherwise, you could try make a new user attribute, then make the same SDK call on that new non-system-setting attribute. 

View original

1 reply

Userlevel 2
first_name First Name System setting
last_name Last Name System setting
email Email System setting
name Full Name System setting
timezone Timezone System setting
id Looker User ID System setting
ldap_user_id LDAP External User ID System setting
saml_user_id Saml External User ID System setting
google_user_id Google Auth External User ID System setting
oidc_user_id OpenID Connect External User ID System setting

 

We can not edit Looker’s system-level attributes (listed in the table above). 

In your example call, `user_attribute_id = 1` is being used. I used `get/user_attributes` to see which attribute this id refers to, and confirm that it refers to “first_name”.

If the intention is to change users’ first name, you could use `sdk.update_user()`. Otherwise, you could try make a new user attribute, then make the same SDK call on that new non-system-setting attribute. 

Reply