Chilkat Online Tools

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

Back to Collection Items

func chilkatTest() {
    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    let http = CkoHttp()
    var success: Bool

    // 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": [
    //     {}
    //   ]
    // }

    let json = CkoJsonObject()

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

    let sbRequestBody = CkoStringBuilder()
    json.EmitSb(sbRequestBody)

    var resp: CkoHttpResponse? = http.PTextSb("PUT", url: "https://domain.com/v2.1/accounts/{{accountId}}/users/{{userId}}/custom_settings", textData: sbRequestBody, charset: "utf-8", contentType: "application/json", md5: false, gzip: false)
    if http.LastMethodSuccess == false {
        print("\(http.LastErrorText)")
        return
    }

    print("\(resp!.StatusCode.intValue)")
    print("\(resp!.BodyStr)")
    resp = nil

}

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}}",
          "type": "string"
        },
        {
          "key": "userId",
          "value": "{{userId}}",
          "type": "string"
        }
      ]
    },
    "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": [
  ]
}