Skip to content

Instantly share code, notes, and snippets.

@mxamin
Created August 15, 2018 05:56
Show Gist options
  • Save mxamin/4140712eabf716e34f8eb4c1f5c89c13 to your computer and use it in GitHub Desktop.
Save mxamin/4140712eabf716e34f8eb4c1f5c89c13 to your computer and use it in GitHub Desktop.
IBSng - Update User's Custom Field Value

IBSng - Update User's Custom Field Value

Suppose we already created a custom field named company for users, now we want to update this attribute for user with user_id 15 with parspooyesh value. In this scenario we have already authenticated with IBSng:

  • client IP address: 192.168.1.101
  • IBSng WS server and port: 192.168.1.104:1237
  • auth_name: system
  • auth_session: w6ig5hwv1ohv
$ curl -H "Content-Type: application/json" \
       -H "Accept: application/json" \
       -H "Accept-Charset: utf-8" \
       -H "Cache-Control: no-cache" \
       -X POST \
       -d '{"params": {"auth_remoteaddr": "192.168.1.101", "auth_type": "ADMIN", "auth_name": "system", "auth_session": "w6ig5hwv1ohv", "user_id": "15", "attrs": {"custom_fields": [{"custom_field_company": "parspooyesh"}, []]}, "to_del_attrs": []}, "method": "user.updateUserAttrs"}' \
       http://192.168.1.104:1237/

Output:

{"id": null, "result": "", "error": null}

In response you will receive nothing which is a good sign that your request executed successfully (of course you must check that the value of error field is null).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment