Forum Discussion

fuenteso's avatar
fuenteso
Leader
8 years ago
Solved

Change user settings using the API

Hi!

Is it possible to change a user setting (preference) using the API? I want to add a link to our 'success post page' that will disable the preference to show that page without having the user going to their profile and manually disable it.

 

According to the documentation, it's possible to change them, but I don't see a list of settings

https://community.lithium.com/t5/Developer-Documentation/bd-p/dev-doc-portal?section=commv1&leaf-id=Settings.name.name.set#Settings.name.name.set 

 

When I use this call on the browser on "/restapi/vc/users/id/<<MYUSERID>>/settings/settings" I only get these:

 

<response status="success">
<settings>
<setting name="profile.signature" type="string">XXXXXX</setting>
<setting name="profile.url_icon" type="string">XXXXXX</setting>
<setting name="user.last_visit_date" type="string">XXXXXX</setting>
<setting name="user.registration_date" type="string">XXXXXX</setting>
</settings>
</response>

 

Any suggestions? 

 

Thanks!

 

  • fuenteso there's no list of the settings, but you can (in most cases) getting it looking at the name of the field in the settings page:

    (be aware that dots are removed, so this is actually config.show_confirm_page_on_post).

    In this case, the call you're looking for is /restapi/vc/users/id/<id>/settings/name/config.show_confirm_page_on_post (and /restapi/vc/users/id/<id>/settings/name/config.show_confirm_page_on_post/set?value=<true,false> to set).

     

     

6 Replies

  • Hi fuenteso  Yes, you can change the users setting by API.  But you need to mention which field setting you want to change.

     

    Like if you want to change the biography of a user

    /users/id/userID/profiles/name/biography/set?value='xyz'
  • VikasB's avatar
    VikasB
    Boss
    8 years ago

    Hi fuenteso  you can get preference list using below API

    /restapi/vc/users/id/UserID/profiles


    Let's come back to the real problem, I think you want that whenever any of the users visits Success Post Page you want to set a flag in their respective profile(setting preference). Right?

    If yes, in such cases you can use user's custom fields. Even user itself can not update those fields from their profile. As these fields can not be seen by the user. Custom fields can be updated by RestAdmin API calls only. 

     

    /users/id/userID/profiles/name/field1/set?value='xyz'

    By default, a user does not have custom fields. You have to raise a ticket to lithium to create a user's profile custom field. 

  • fuenteso's avatar
    fuenteso
    Leader
    8 years ago
    VikasGrazitti wrote:

    Let's come back to the real problem, I think you want that whenever any of the users visits Success Post Page you want to set a flag in their respective profile(setting preference). Right?

    If yes, in such cases you can use user's custom fields. Even user itself can not update those fields from their profile. As these fields can not be seen by the user. Custom fields can be updated by RestAdmin API calls only. 

     Well, not exacly, I want to save the user the trouble of going to their user preferences (/t5/user/myprofilepage/tab/user-preferences) and uncheck "Show confirmation pages for posts" and then save their preferences. 

     

  • ChiaraS's avatar
    ChiaraS
    Lithium Alumni (Retired)
    8 years ago

    fuenteso there's no list of the settings, but you can (in most cases) getting it looking at the name of the field in the settings page:

    (be aware that dots are removed, so this is actually config.show_confirm_page_on_post).

    In this case, the call you're looking for is /restapi/vc/users/id/<id>/settings/name/config.show_confirm_page_on_post (and /restapi/vc/users/id/<id>/settings/name/config.show_confirm_page_on_post/set?value=<true,false> to set).