Chilkat Online Tools

Ruby / DocuSign REST API / Adds or updates custom user settings for the specified user.

Back to Collection Items

require 'chilkat'

# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

http = Chilkat::CkHttp.new()

# Use this online tool to generate code from sample JSON: Generate Code to Create JSON

# The following JSON is sent in the request body.

# {
#   "customSettings": [
#     {}
#   ]
# }

json = Chilkat::CkJsonObject.new()

# Adds the "Authorization: Bearer {{accessToken}}" header.
http.put_AuthToken("{{accessToken}}")
http.SetRequestHeader("Accept","application/json")

sbRequestBody = Chilkat::CkStringBuilder.new()
json.EmitSb(sbRequestBody)

# resp is a CkHttpResponse
resp = http.PTextSb("PUT","https://domain.com/v2.1/accounts/{{accountId}}/users/{{userId}}/custom_settings",sbRequestBody,"utf-8","application/json",false,false)
if (http.get_LastMethodSuccess() == false)
    print http.lastErrorText() + "\n";
    exit
end

print resp.get_StatusCode().to_s() + "\n";
print resp.bodyStr() + "\n";

Curl Command

curl -X PUT
	-H "Accept: application/json"
	-H "Authorization: Bearer {{accessToken}}"
	-d '{
  "customSettings": [
    {}
  ]
}'
https://domain.com/v2.1/accounts/{{accountId}}/users/{{userId}}/custom_settings

Postman Collection Item JSON

{
  "name": "Adds or updates custom user settings for the specified user.",
  "request": {
    "method": "PUT",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      },
      {
        "key": "Authorization",
        "value": "Bearer {{accessToken}}"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n  \"customSettings\": [\n    {}\n  ]\n}"
    },
    "url": {
      "raw": "{{baseUrl}}/v2.1/accounts/{{accountId}}/users/{{userId}}/custom_settings",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "v2.1",
        "accounts",
        "{{accountId}}",
        "users",
        "{{userId}}",
        "custom_settings"
      ],
      "variable": [
        {
          "key": "accountId",
          "value": "{{accountId}}"
        },
        {
          "key": "userId",
          "value": "{{userId}}"
        }
      ]
    },
    "description": "Adds or updates custom user settings for the specified user.\n\n###### Note: Custom user settings are not the same as user account settings.\n\nCustom settings provide a flexible way to store and retrieve custom user information that you can use in your own system.\n\n**Important**: There is a limit on the size for all the custom user settings for a single user. The limit is 4,000 characters, which includes the XML and JSON structure for the settings.\n\n### Grouping Custom User Settings ###\n\nYou can group custom user settings when adding them. Grouping allows you to retrieve settings that are in a specific group, instead of retrieving all the user custom settings.\n\nTo group custom user settings, add the following information in the header, after Content-Type:\n\n`X-DocuSign-User-Settings-Key:group_name`\n\nWhere the `group_name` is your designated name for the group of customer user settings. Grouping is shown in the Example Request Body below.\n\nWhen getting or deleting grouped custom user settings, you must include the extra header information.\n\nGrouping custom user settings is not required and if the extra header information is not included, the custom user settings are added normally and can be retrieved or deleted without including the additional header."
  },
  "response": [
  ]
}