Chilkat Online Tools

Objective-C / DocuSign eSignature REST API / Updates the specified user information.

Back to Collection Items

#import <CkoHttp.h>
#import <CkoJsonObject.h>
#import <CkoStringBuilder.h>
#import <CkoHttpResponse.h>

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

CkoHttp *http = [[CkoHttp alloc] init];
BOOL success;

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

// The following JSON is sent in the request body.

// {
//   "userName": "sample string 1",
//   "userId": "sample string 2",
//   "userType": "sample string 3",
//   "isAdmin": "sample string 4",
//   "userStatus": "sample string 5",
//   "uri": "sample string 6",
//   "email": "sample string 7",
//   "password": "sample string 8",
//   "title": "sample string 9",
//   "createdDateTime": "sample string 10",
//   "firstName": "sample string 11",
//   "middleName": "sample string 12",
//   "lastName": "sample string 13",
//   "suffixName": "sample string 14",
//   "permissionProfileId": "sample string 15",
//   "permissionProfileName": "sample string 16",
//   "countryCode": "sample string 17",
//   "subscribe": "sample string 18",
//   "userSettings": [
//     {}
//   ],
//   "accountManagementGranular": {
//     "canManageUsers": "sample string 1",
//     "canManageAdmins": "sample string 2",
//     "canManageGroups": "sample string 3",
//     "canManageSharing": "sample string 4",
//     "canManageAccountSettings": "sample string 5",
//     "canManageReporting": "sample string 6",
//     "canManageAccountSecuritySettings": "sample string 7",
//     "canManageSigningGroups": "sample string 8",
//     "canViewUsers": "sample string 9",
//     "canManageUsersMetadata": {
//       "rights": "sample string 1",
//       "uiHint": "sample string 2",
//       "uiType": "sample string 3",
//       "uiOrder": "sample string 4",
//       "is21CFRPart11": "sample string 5",
//       "options": [
//         "sample string 1"
//       ]
//     },
//     "canManageAdminsMetadata": {},
//     "canManageGroupsMetadata": {},
//     "canManageSharingMetadata": {},
//     "canManageAccountSettingsMetadata": {},
//     "canManageReportingMetadata": {},
//     "canManageAccountSecuritySettingsMetadata": {},
//     "canManageSigningGroupsMetadata": {},
//     "canViewUsersMetadata": {}
//   },
//   "sendActivationOnInvalidLogin": "sample string 19",
//   "activationAccessCode": "sample string 20",
//   "enableConnectForUser": "sample string 21",
//   "forgottenPasswordInfo": {
//     "forgottenPasswordQuestion1": "sample string 1",
//     "forgottenPasswordAnswer1": "sample string 2",
//     "forgottenPasswordQuestion2": "sample string 3",
//     "forgottenPasswordAnswer2": "sample string 4",
//     "forgottenPasswordQuestion3": "sample string 5",
//     "forgottenPasswordAnswer3": "sample string 6",
//     "forgottenPasswordQuestion4": "sample string 7",
//     "forgottenPasswordAnswer4": "sample string 8"
//   },
//   "groupList": [
//     {
//       "groupId": "sample string 1",
//       "groupName": "sample string 2",
//       "permissionProfileId": "sample string 3",
//       "groupType": "sample string 4",
//       "users": [
//         {
//           "userName": "sample string 1",
//           "userId": "sample string 2",
//           "email": "sample string 3",
//           "userType": "sample string 4",
//           "userStatus": "sample string 5",
//           "uri": "sample string 6",
//           "loginStatus": "sample string 7",
//           "sendActivationEmail": "sample string 8",
//           "activationAccessCode": "sample string 9"
//         }
//       ]
//     }
//   ],
//   "workAddress": {
//     "address1": "sample string 1",
//     "address2": "sample string 2",
//     "city": "sample string 3",
//     "stateOrProvince": "sample string 4",
//     "postalCode": "sample string 5",
//     "phone": "sample string 6",
//     "fax": "sample string 7",
//     "country": "sample string 8"
//   },
//   "homeAddress": {},
//   "loginStatus": "sample string 22",
//   "passwordExpiration": "sample string 23",
//   "lastLogin": "sample string 24",
//   "sendActivationEmail": "sample string 25",
//   "customSettings": [
//     {}
//   ],
//   "profileImageUri": "sample string 26",
//   "userProfileLastModifiedDate": "sample string 27",
//   "signatureImageUri": "sample string 28",
//   "initialsImageUri": "sample string 29",
//   "jobTitle": "sample string 30"
// }

CkoJsonObject *json = [[CkoJsonObject alloc] init];
[json UpdateString: @"userName" value: @"sample string 1"];
[json UpdateString: @"userId" value: @"sample string 2"];
[json UpdateString: @"userType" value: @"sample string 3"];
[json UpdateString: @"isAdmin" value: @"sample string 4"];
[json UpdateString: @"userStatus" value: @"sample string 5"];
[json UpdateString: @"uri" value: @"sample string 6"];
[json UpdateString: @"email" value: @"sample string 7"];
[json UpdateString: @"password" value: @"sample string 8"];
[json UpdateString: @"title" value: @"sample string 9"];
[json UpdateString: @"createdDateTime" value: @"sample string 10"];
[json UpdateString: @"firstName" value: @"sample string 11"];
[json UpdateString: @"middleName" value: @"sample string 12"];
[json UpdateString: @"lastName" value: @"sample string 13"];
[json UpdateString: @"suffixName" value: @"sample string 14"];
[json UpdateString: @"permissionProfileId" value: @"sample string 15"];
[json UpdateString: @"permissionProfileName" value: @"sample string 16"];
[json UpdateString: @"countryCode" value: @"sample string 17"];
[json UpdateString: @"subscribe" value: @"sample string 18"];
[json UpdateString: @"accountManagementGranular.canManageUsers" value: @"sample string 1"];
[json UpdateString: @"accountManagementGranular.canManageAdmins" value: @"sample string 2"];
[json UpdateString: @"accountManagementGranular.canManageGroups" value: @"sample string 3"];
[json UpdateString: @"accountManagementGranular.canManageSharing" value: @"sample string 4"];
[json UpdateString: @"accountManagementGranular.canManageAccountSettings" value: @"sample string 5"];
[json UpdateString: @"accountManagementGranular.canManageReporting" value: @"sample string 6"];
[json UpdateString: @"accountManagementGranular.canManageAccountSecuritySettings" value: @"sample string 7"];
[json UpdateString: @"accountManagementGranular.canManageSigningGroups" value: @"sample string 8"];
[json UpdateString: @"accountManagementGranular.canViewUsers" value: @"sample string 9"];
[json UpdateString: @"accountManagementGranular.canManageUsersMetadata.rights" value: @"sample string 1"];
[json UpdateString: @"accountManagementGranular.canManageUsersMetadata.uiHint" value: @"sample string 2"];
[json UpdateString: @"accountManagementGranular.canManageUsersMetadata.uiType" value: @"sample string 3"];
[json UpdateString: @"accountManagementGranular.canManageUsersMetadata.uiOrder" value: @"sample string 4"];
[json UpdateString: @"accountManagementGranular.canManageUsersMetadata.is21CFRPart11" value: @"sample string 5"];
[json UpdateString: @"accountManagementGranular.canManageUsersMetadata.options[0]" value: @"sample string 1"];
[json UpdateNewObject: @"accountManagementGranular.canManageAdminsMetadata"];
[json UpdateNewObject: @"accountManagementGranular.canManageGroupsMetadata"];
[json UpdateNewObject: @"accountManagementGranular.canManageSharingMetadata"];
[json UpdateNewObject: @"accountManagementGranular.canManageAccountSettingsMetadata"];
[json UpdateNewObject: @"accountManagementGranular.canManageReportingMetadata"];
[json UpdateNewObject: @"accountManagementGranular.canManageAccountSecuritySettingsMetadata"];
[json UpdateNewObject: @"accountManagementGranular.canManageSigningGroupsMetadata"];
[json UpdateNewObject: @"accountManagementGranular.canViewUsersMetadata"];
[json UpdateString: @"sendActivationOnInvalidLogin" value: @"sample string 19"];
[json UpdateString: @"activationAccessCode" value: @"sample string 20"];
[json UpdateString: @"enableConnectForUser" value: @"sample string 21"];
[json UpdateString: @"forgottenPasswordInfo.forgottenPasswordQuestion1" value: @"sample string 1"];
[json UpdateString: @"forgottenPasswordInfo.forgottenPasswordAnswer1" value: @"sample string 2"];
[json UpdateString: @"forgottenPasswordInfo.forgottenPasswordQuestion2" value: @"sample string 3"];
[json UpdateString: @"forgottenPasswordInfo.forgottenPasswordAnswer2" value: @"sample string 4"];
[json UpdateString: @"forgottenPasswordInfo.forgottenPasswordQuestion3" value: @"sample string 5"];
[json UpdateString: @"forgottenPasswordInfo.forgottenPasswordAnswer3" value: @"sample string 6"];
[json UpdateString: @"forgottenPasswordInfo.forgottenPasswordQuestion4" value: @"sample string 7"];
[json UpdateString: @"forgottenPasswordInfo.forgottenPasswordAnswer4" value: @"sample string 8"];
[json UpdateString: @"groupList[0].groupId" value: @"sample string 1"];
[json UpdateString: @"groupList[0].groupName" value: @"sample string 2"];
[json UpdateString: @"groupList[0].permissionProfileId" value: @"sample string 3"];
[json UpdateString: @"groupList[0].groupType" value: @"sample string 4"];
[json UpdateString: @"groupList[0].users[0].userName" value: @"sample string 1"];
[json UpdateString: @"groupList[0].users[0].userId" value: @"sample string 2"];
[json UpdateString: @"groupList[0].users[0].email" value: @"sample string 3"];
[json UpdateString: @"groupList[0].users[0].userType" value: @"sample string 4"];
[json UpdateString: @"groupList[0].users[0].userStatus" value: @"sample string 5"];
[json UpdateString: @"groupList[0].users[0].uri" value: @"sample string 6"];
[json UpdateString: @"groupList[0].users[0].loginStatus" value: @"sample string 7"];
[json UpdateString: @"groupList[0].users[0].sendActivationEmail" value: @"sample string 8"];
[json UpdateString: @"groupList[0].users[0].activationAccessCode" value: @"sample string 9"];
[json UpdateString: @"workAddress.address1" value: @"sample string 1"];
[json UpdateString: @"workAddress.address2" value: @"sample string 2"];
[json UpdateString: @"workAddress.city" value: @"sample string 3"];
[json UpdateString: @"workAddress.stateOrProvince" value: @"sample string 4"];
[json UpdateString: @"workAddress.postalCode" value: @"sample string 5"];
[json UpdateString: @"workAddress.phone" value: @"sample string 6"];
[json UpdateString: @"workAddress.fax" value: @"sample string 7"];
[json UpdateString: @"workAddress.country" value: @"sample string 8"];
[json UpdateNewObject: @"homeAddress"];
[json UpdateString: @"loginStatus" value: @"sample string 22"];
[json UpdateString: @"passwordExpiration" value: @"sample string 23"];
[json UpdateString: @"lastLogin" value: @"sample string 24"];
[json UpdateString: @"sendActivationEmail" value: @"sample string 25"];
[json UpdateString: @"profileImageUri" value: @"sample string 26"];
[json UpdateString: @"userProfileLastModifiedDate" value: @"sample string 27"];
[json UpdateString: @"signatureImageUri" value: @"sample string 28"];
[json UpdateString: @"initialsImageUri" value: @"sample string 29"];
[json UpdateString: @"jobTitle" value: @"sample string 30"];

// Adds the "Authorization: Bearer {{accessToken}}" header.
http.AuthToken = @"{{accessToken}}";
[http SetRequestHeader: @"Accept" value: @"application/json"];

CkoStringBuilder *sbRequestBody = [[CkoStringBuilder alloc] init];
[json EmitSb: sbRequestBody];

CkoHttpResponse *resp = [http PTextSb: @"PUT" url: @"https://domain.com/v2.1/accounts/{{accountId}}/users/{{userId}}" textData: sbRequestBody charset: @"utf-8" contentType: @"application/json" md5: NO gzip: NO];
if (http.LastMethodSuccess == NO) {
    NSLog(@"%@",http.LastErrorText);
    return;
}

NSLog(@"%d",[resp.StatusCode intValue]);
NSLog(@"%@",resp.BodyStr);

Curl Command

curl -X PUT
	-H "Accept: application/json"
	-H "Authorization: Bearer {{accessToken}}"
	-d '{
  "userName": "sample string 1",
  "userId": "sample string 2",
  "userType": "sample string 3",
  "isAdmin": "sample string 4",
  "userStatus": "sample string 5",
  "uri": "sample string 6",
  "email": "sample string 7",
  "password": "sample string 8",
  "title": "sample string 9",
  "createdDateTime": "sample string 10",
  "firstName": "sample string 11",
  "middleName": "sample string 12",
  "lastName": "sample string 13",
  "suffixName": "sample string 14",
  "permissionProfileId": "sample string 15",
  "permissionProfileName": "sample string 16",
  "countryCode": "sample string 17",
  "subscribe": "sample string 18",
  "userSettings": [
    {}
  ],
  "accountManagementGranular": {
    "canManageUsers": "sample string 1",
    "canManageAdmins": "sample string 2",
    "canManageGroups": "sample string 3",
    "canManageSharing": "sample string 4",
    "canManageAccountSettings": "sample string 5",
    "canManageReporting": "sample string 6",
    "canManageAccountSecuritySettings": "sample string 7",
    "canManageSigningGroups": "sample string 8",
    "canViewUsers": "sample string 9",
    "canManageUsersMetadata": {
      "rights": "sample string 1",
      "uiHint": "sample string 2",
      "uiType": "sample string 3",
      "uiOrder": "sample string 4",
      "is21CFRPart11": "sample string 5",
      "options": [
        "sample string 1"
      ]
    },
    "canManageAdminsMetadata": {},
    "canManageGroupsMetadata": {},
    "canManageSharingMetadata": {},
    "canManageAccountSettingsMetadata": {},
    "canManageReportingMetadata": {},
    "canManageAccountSecuritySettingsMetadata": {},
    "canManageSigningGroupsMetadata": {},
    "canViewUsersMetadata": {}
  },
  "sendActivationOnInvalidLogin": "sample string 19",
  "activationAccessCode": "sample string 20",
  "enableConnectForUser": "sample string 21",
  "forgottenPasswordInfo": {
    "forgottenPasswordQuestion1": "sample string 1",
    "forgottenPasswordAnswer1": "sample string 2",
    "forgottenPasswordQuestion2": "sample string 3",
    "forgottenPasswordAnswer2": "sample string 4",
    "forgottenPasswordQuestion3": "sample string 5",
    "forgottenPasswordAnswer3": "sample string 6",
    "forgottenPasswordQuestion4": "sample string 7",
    "forgottenPasswordAnswer4": "sample string 8"
  },
  "groupList": [
    {
      "groupId": "sample string 1",
      "groupName": "sample string 2",
      "permissionProfileId": "sample string 3",
      "groupType": "sample string 4",
      "users": [
        {
          "userName": "sample string 1",
          "userId": "sample string 2",
          "email": "sample string 3",
          "userType": "sample string 4",
          "userStatus": "sample string 5",
          "uri": "sample string 6",
          "loginStatus": "sample string 7",
          "sendActivationEmail": "sample string 8",
          "activationAccessCode": "sample string 9"
        }
      ]
    }
  ],
  "workAddress": {
    "address1": "sample string 1",
    "address2": "sample string 2",
    "city": "sample string 3",
    "stateOrProvince": "sample string 4",
    "postalCode": "sample string 5",
    "phone": "sample string 6",
    "fax": "sample string 7",
    "country": "sample string 8"
  },
  "homeAddress": {},
  "loginStatus": "sample string 22",
  "passwordExpiration": "sample string 23",
  "lastLogin": "sample string 24",
  "sendActivationEmail": "sample string 25",
  "customSettings": [
    {}
  ],
  "profileImageUri": "sample string 26",
  "userProfileLastModifiedDate": "sample string 27",
  "signatureImageUri": "sample string 28",
  "initialsImageUri": "sample string 29",
  "jobTitle": "sample string 30"
}'
https://domain.com/v2.1/accounts/{{accountId}}/users/{{userId}}

Postman Collection Item JSON

{
  "name": "Updates the specified user information.",
  "request": {
    "method": "PUT",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      },
      {
        "key": "Authorization",
        "value": "Bearer {{accessToken}}"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n  \"userName\": \"sample string 1\",\n  \"userId\": \"sample string 2\",\n  \"userType\": \"sample string 3\",\n  \"isAdmin\": \"sample string 4\",\n  \"userStatus\": \"sample string 5\",\n  \"uri\": \"sample string 6\",\n  \"email\": \"sample string 7\",\n  \"password\": \"sample string 8\",\n  \"title\": \"sample string 9\",\n  \"createdDateTime\": \"sample string 10\",\n  \"firstName\": \"sample string 11\",\n  \"middleName\": \"sample string 12\",\n  \"lastName\": \"sample string 13\",\n  \"suffixName\": \"sample string 14\",\n  \"permissionProfileId\": \"sample string 15\",\n  \"permissionProfileName\": \"sample string 16\",\n  \"countryCode\": \"sample string 17\",\n  \"subscribe\": \"sample string 18\",\n  \"userSettings\": [\n    {}\n  ],\n  \"accountManagementGranular\": {\n    \"canManageUsers\": \"sample string 1\",\n    \"canManageAdmins\": \"sample string 2\",\n    \"canManageGroups\": \"sample string 3\",\n    \"canManageSharing\": \"sample string 4\",\n    \"canManageAccountSettings\": \"sample string 5\",\n    \"canManageReporting\": \"sample string 6\",\n    \"canManageAccountSecuritySettings\": \"sample string 7\",\n    \"canManageSigningGroups\": \"sample string 8\",\n    \"canViewUsers\": \"sample string 9\",\n    \"canManageUsersMetadata\": {\n      \"rights\": \"sample string 1\",\n      \"uiHint\": \"sample string 2\",\n      \"uiType\": \"sample string 3\",\n      \"uiOrder\": \"sample string 4\",\n      \"is21CFRPart11\": \"sample string 5\",\n      \"options\": [\n        \"sample string 1\"\n      ]\n    },\n    \"canManageAdminsMetadata\": {},\n    \"canManageGroupsMetadata\": {},\n    \"canManageSharingMetadata\": {},\n    \"canManageAccountSettingsMetadata\": {},\n    \"canManageReportingMetadata\": {},\n    \"canManageAccountSecuritySettingsMetadata\": {},\n    \"canManageSigningGroupsMetadata\": {},\n    \"canViewUsersMetadata\": {}\n  },\n  \"sendActivationOnInvalidLogin\": \"sample string 19\",\n  \"activationAccessCode\": \"sample string 20\",\n  \"enableConnectForUser\": \"sample string 21\",\n  \"forgottenPasswordInfo\": {\n    \"forgottenPasswordQuestion1\": \"sample string 1\",\n    \"forgottenPasswordAnswer1\": \"sample string 2\",\n    \"forgottenPasswordQuestion2\": \"sample string 3\",\n    \"forgottenPasswordAnswer2\": \"sample string 4\",\n    \"forgottenPasswordQuestion3\": \"sample string 5\",\n    \"forgottenPasswordAnswer3\": \"sample string 6\",\n    \"forgottenPasswordQuestion4\": \"sample string 7\",\n    \"forgottenPasswordAnswer4\": \"sample string 8\"\n  },\n  \"groupList\": [\n    {\n      \"groupId\": \"sample string 1\",\n      \"groupName\": \"sample string 2\",\n      \"permissionProfileId\": \"sample string 3\",\n      \"groupType\": \"sample string 4\",\n      \"users\": [\n        {\n          \"userName\": \"sample string 1\",\n          \"userId\": \"sample string 2\",\n          \"email\": \"sample string 3\",\n          \"userType\": \"sample string 4\",\n          \"userStatus\": \"sample string 5\",\n          \"uri\": \"sample string 6\",\n          \"loginStatus\": \"sample string 7\",\n          \"sendActivationEmail\": \"sample string 8\",\n          \"activationAccessCode\": \"sample string 9\"\n        }\n      ]\n    }\n  ],\n  \"workAddress\": {\n    \"address1\": \"sample string 1\",\n    \"address2\": \"sample string 2\",\n    \"city\": \"sample string 3\",\n    \"stateOrProvince\": \"sample string 4\",\n    \"postalCode\": \"sample string 5\",\n    \"phone\": \"sample string 6\",\n    \"fax\": \"sample string 7\",\n    \"country\": \"sample string 8\"\n  },\n  \"homeAddress\": {},\n  \"loginStatus\": \"sample string 22\",\n  \"passwordExpiration\": \"sample string 23\",\n  \"lastLogin\": \"sample string 24\",\n  \"sendActivationEmail\": \"sample string 25\",\n  \"customSettings\": [\n    {}\n  ],\n  \"profileImageUri\": \"sample string 26\",\n  \"userProfileLastModifiedDate\": \"sample string 27\",\n  \"signatureImageUri\": \"sample string 28\",\n  \"initialsImageUri\": \"sample string 29\",\n  \"jobTitle\": \"sample string 30\"\n}"
    },
    "url": {
      "raw": "{{baseUrl}}/v2.1/accounts/{{accountId}}/users/{{userId}}",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "v2.1",
        "accounts",
        "{{accountId}}",
        "users",
        "{{userId}}"
      ],
      "variable": [
        {
          "key": "accountId",
          "value": "{{accountId}}",
          "type": "string"
        },
        {
          "key": "userId",
          "value": "{{userId}}",
          "type": "string"
        }
      ]
    }
  },
  "response": [
  ]
}