Chilkat Online Tools

unicodeC / DocuSign REST API / Modifies tab settings for specified account

Back to Collection Items

#include <C_CkHttpW.h>
#include <C_CkJsonObjectW.h>
#include <C_CkStringBuilderW.h>
#include <C_CkHttpResponseW.h>

void ChilkatSample(void)
    {
    HCkHttpW http;
    BOOL success;
    HCkJsonObjectW json;
    HCkStringBuilderW sbRequestBody;
    HCkHttpResponseW resp;

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

    http = CkHttpW_Create();

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

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

    // {
    //   "textTabsEnabled": "sample string 1",
    //   "textTabsMetadata": {
    //     "rights": "sample string 1",
    //     "uiHint": "sample string 2",
    //     "uiType": "sample string 3",
    //     "uiOrder": "sample string 4",
    //     "is21CFRPart11": "sample string 5",
    //     "options": [
    //       "sample string 1"
    //     ]
    //   },
    //   "radioTabsEnabled": "sample string 2",
    //   "radioTabsMetadata": {},
    //   "checkboxTabsEnabled": "sample string 3",
    //   "checkboxTabsMetadata": {},
    //   "listTabsEnabled": "sample string 4",
    //   "listTabsMetadata": {},
    //   "approveDeclineTabsEnabled": "sample string 5",
    //   "approveDeclineTabsMetadata": {},
    //   "noteTabsEnabled": "sample string 6",
    //   "noteTabsMetadata": {},
    //   "dataFieldRegexEnabled": "sample string 7",
    //   "dataFieldRegexMetadata": {},
    //   "dataFieldSizeEnabled": "sample string 8",
    //   "dataFieldSizeMetadata": {},
    //   "tabLocationEnabled": "sample string 9",
    //   "tabLocationMetadata": {},
    //   "tabScaleEnabled": "sample string 10",
    //   "tabScaleMetadata": {},
    //   "tabLockingEnabled": "sample string 11",
    //   "tabLockingMetadata": {},
    //   "savingCustomTabsEnabled": "sample string 12",
    //   "savingCustomTabsMetadata": {},
    //   "tabTextFormattingEnabled": "sample string 13",
    //   "tabTextFormattingMetadata": {},
    //   "sharedCustomTabsEnabled": "sample string 14",
    //   "sharedCustomTabsMetadata": {},
    //   "senderToChangeTabAssignmentsEnabled": "sample string 15",
    //   "senderToChangeTabAssignmentsMetadata": {},
    //   "tabDataLabelEnabled": "sample string 16",
    //   "tabDataLabelMetadata": {},
    //   "firstLastEmailTabsEnabled": "sample string 17",
    //   "firstLastEmailTabsMetadata": {},
    //   "calculatedFieldsEnabled": "sample string 18",
    //   "calculatedFieldsMetadata": {},
    //   "allowTabOrder": "sample string 19",
    //   "allowTabOrderMetadata": {}
    // }

    json = CkJsonObjectW_Create();
    CkJsonObjectW_UpdateString(json,L"textTabsEnabled",L"sample string 1");
    CkJsonObjectW_UpdateString(json,L"textTabsMetadata.rights",L"sample string 1");
    CkJsonObjectW_UpdateString(json,L"textTabsMetadata.uiHint",L"sample string 2");
    CkJsonObjectW_UpdateString(json,L"textTabsMetadata.uiType",L"sample string 3");
    CkJsonObjectW_UpdateString(json,L"textTabsMetadata.uiOrder",L"sample string 4");
    CkJsonObjectW_UpdateString(json,L"textTabsMetadata.is21CFRPart11",L"sample string 5");
    CkJsonObjectW_UpdateString(json,L"textTabsMetadata.options[0]",L"sample string 1");
    CkJsonObjectW_UpdateString(json,L"radioTabsEnabled",L"sample string 2");
    CkJsonObjectW_UpdateNewObject(json,L"radioTabsMetadata");
    CkJsonObjectW_UpdateString(json,L"checkboxTabsEnabled",L"sample string 3");
    CkJsonObjectW_UpdateNewObject(json,L"checkboxTabsMetadata");
    CkJsonObjectW_UpdateString(json,L"listTabsEnabled",L"sample string 4");
    CkJsonObjectW_UpdateNewObject(json,L"listTabsMetadata");
    CkJsonObjectW_UpdateString(json,L"approveDeclineTabsEnabled",L"sample string 5");
    CkJsonObjectW_UpdateNewObject(json,L"approveDeclineTabsMetadata");
    CkJsonObjectW_UpdateString(json,L"noteTabsEnabled",L"sample string 6");
    CkJsonObjectW_UpdateNewObject(json,L"noteTabsMetadata");
    CkJsonObjectW_UpdateString(json,L"dataFieldRegexEnabled",L"sample string 7");
    CkJsonObjectW_UpdateNewObject(json,L"dataFieldRegexMetadata");
    CkJsonObjectW_UpdateString(json,L"dataFieldSizeEnabled",L"sample string 8");
    CkJsonObjectW_UpdateNewObject(json,L"dataFieldSizeMetadata");
    CkJsonObjectW_UpdateString(json,L"tabLocationEnabled",L"sample string 9");
    CkJsonObjectW_UpdateNewObject(json,L"tabLocationMetadata");
    CkJsonObjectW_UpdateString(json,L"tabScaleEnabled",L"sample string 10");
    CkJsonObjectW_UpdateNewObject(json,L"tabScaleMetadata");
    CkJsonObjectW_UpdateString(json,L"tabLockingEnabled",L"sample string 11");
    CkJsonObjectW_UpdateNewObject(json,L"tabLockingMetadata");
    CkJsonObjectW_UpdateString(json,L"savingCustomTabsEnabled",L"sample string 12");
    CkJsonObjectW_UpdateNewObject(json,L"savingCustomTabsMetadata");
    CkJsonObjectW_UpdateString(json,L"tabTextFormattingEnabled",L"sample string 13");
    CkJsonObjectW_UpdateNewObject(json,L"tabTextFormattingMetadata");
    CkJsonObjectW_UpdateString(json,L"sharedCustomTabsEnabled",L"sample string 14");
    CkJsonObjectW_UpdateNewObject(json,L"sharedCustomTabsMetadata");
    CkJsonObjectW_UpdateString(json,L"senderToChangeTabAssignmentsEnabled",L"sample string 15");
    CkJsonObjectW_UpdateNewObject(json,L"senderToChangeTabAssignmentsMetadata");
    CkJsonObjectW_UpdateString(json,L"tabDataLabelEnabled",L"sample string 16");
    CkJsonObjectW_UpdateNewObject(json,L"tabDataLabelMetadata");
    CkJsonObjectW_UpdateString(json,L"firstLastEmailTabsEnabled",L"sample string 17");
    CkJsonObjectW_UpdateNewObject(json,L"firstLastEmailTabsMetadata");
    CkJsonObjectW_UpdateString(json,L"calculatedFieldsEnabled",L"sample string 18");
    CkJsonObjectW_UpdateNewObject(json,L"calculatedFieldsMetadata");
    CkJsonObjectW_UpdateString(json,L"allowTabOrder",L"sample string 19");
    CkJsonObjectW_UpdateNewObject(json,L"allowTabOrderMetadata");

    // Adds the "Authorization: Bearer {{accessToken}}" header.
    CkHttpW_putAuthToken(http,L"{{accessToken}}");
    CkHttpW_SetRequestHeader(http,L"Accept",L"application/json");

    sbRequestBody = CkStringBuilderW_Create();
    CkJsonObjectW_EmitSb(json,sbRequestBody);

    resp = CkHttpW_PTextSb(http,L"PUT",L"https://domain.com/v2.1/accounts/{{accountId}}/settings/tabs",sbRequestBody,L"utf-8",L"application/json",FALSE,FALSE);
    if (CkHttpW_getLastMethodSuccess(http) == FALSE) {
        wprintf(L"%s\n",CkHttpW_lastErrorText(http));
        CkHttpW_Dispose(http);
        CkJsonObjectW_Dispose(json);
        CkStringBuilderW_Dispose(sbRequestBody);
        return;
    }

    wprintf(L"%d\n",CkHttpResponseW_getStatusCode(resp));
    wprintf(L"%s\n",CkHttpResponseW_bodyStr(resp));
    CkHttpResponseW_Dispose(resp);


    CkHttpW_Dispose(http);
    CkJsonObjectW_Dispose(json);
    CkStringBuilderW_Dispose(sbRequestBody);

    }

Curl Command

curl -X PUT
	-H "Accept: application/json"
	-H "Authorization: Bearer {{accessToken}}"
	-d '{
  "textTabsEnabled": "sample string 1",
  "textTabsMetadata": {
    "rights": "sample string 1",
    "uiHint": "sample string 2",
    "uiType": "sample string 3",
    "uiOrder": "sample string 4",
    "is21CFRPart11": "sample string 5",
    "options": [
      "sample string 1"
    ]
  },
  "radioTabsEnabled": "sample string 2",
  "radioTabsMetadata": {},
  "checkboxTabsEnabled": "sample string 3",
  "checkboxTabsMetadata": {},
  "listTabsEnabled": "sample string 4",
  "listTabsMetadata": {},
  "approveDeclineTabsEnabled": "sample string 5",
  "approveDeclineTabsMetadata": {},
  "noteTabsEnabled": "sample string 6",
  "noteTabsMetadata": {},
  "dataFieldRegexEnabled": "sample string 7",
  "dataFieldRegexMetadata": {},
  "dataFieldSizeEnabled": "sample string 8",
  "dataFieldSizeMetadata": {},
  "tabLocationEnabled": "sample string 9",
  "tabLocationMetadata": {},
  "tabScaleEnabled": "sample string 10",
  "tabScaleMetadata": {},
  "tabLockingEnabled": "sample string 11",
  "tabLockingMetadata": {},
  "savingCustomTabsEnabled": "sample string 12",
  "savingCustomTabsMetadata": {},
  "tabTextFormattingEnabled": "sample string 13",
  "tabTextFormattingMetadata": {},
  "sharedCustomTabsEnabled": "sample string 14",
  "sharedCustomTabsMetadata": {},
  "senderToChangeTabAssignmentsEnabled": "sample string 15",
  "senderToChangeTabAssignmentsMetadata": {},
  "tabDataLabelEnabled": "sample string 16",
  "tabDataLabelMetadata": {},
  "firstLastEmailTabsEnabled": "sample string 17",
  "firstLastEmailTabsMetadata": {},
  "calculatedFieldsEnabled": "sample string 18",
  "calculatedFieldsMetadata": {},
  "allowTabOrder": "sample string 19",
  "allowTabOrderMetadata": {}
}'
https://domain.com/v2.1/accounts/{{accountId}}/settings/tabs

Postman Collection Item JSON

{
  "name": "Modifies tab settings for specified account",
  "request": {
    "method": "PUT",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      },
      {
        "key": "Authorization",
        "value": "Bearer {{accessToken}}"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n  \"textTabsEnabled\": \"sample string 1\",\n  \"textTabsMetadata\": {\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  \"radioTabsEnabled\": \"sample string 2\",\n  \"radioTabsMetadata\": {},\n  \"checkboxTabsEnabled\": \"sample string 3\",\n  \"checkboxTabsMetadata\": {},\n  \"listTabsEnabled\": \"sample string 4\",\n  \"listTabsMetadata\": {},\n  \"approveDeclineTabsEnabled\": \"sample string 5\",\n  \"approveDeclineTabsMetadata\": {},\n  \"noteTabsEnabled\": \"sample string 6\",\n  \"noteTabsMetadata\": {},\n  \"dataFieldRegexEnabled\": \"sample string 7\",\n  \"dataFieldRegexMetadata\": {},\n  \"dataFieldSizeEnabled\": \"sample string 8\",\n  \"dataFieldSizeMetadata\": {},\n  \"tabLocationEnabled\": \"sample string 9\",\n  \"tabLocationMetadata\": {},\n  \"tabScaleEnabled\": \"sample string 10\",\n  \"tabScaleMetadata\": {},\n  \"tabLockingEnabled\": \"sample string 11\",\n  \"tabLockingMetadata\": {},\n  \"savingCustomTabsEnabled\": \"sample string 12\",\n  \"savingCustomTabsMetadata\": {},\n  \"tabTextFormattingEnabled\": \"sample string 13\",\n  \"tabTextFormattingMetadata\": {},\n  \"sharedCustomTabsEnabled\": \"sample string 14\",\n  \"sharedCustomTabsMetadata\": {},\n  \"senderToChangeTabAssignmentsEnabled\": \"sample string 15\",\n  \"senderToChangeTabAssignmentsMetadata\": {},\n  \"tabDataLabelEnabled\": \"sample string 16\",\n  \"tabDataLabelMetadata\": {},\n  \"firstLastEmailTabsEnabled\": \"sample string 17\",\n  \"firstLastEmailTabsMetadata\": {},\n  \"calculatedFieldsEnabled\": \"sample string 18\",\n  \"calculatedFieldsMetadata\": {},\n  \"allowTabOrder\": \"sample string 19\",\n  \"allowTabOrderMetadata\": {}\n}"
    },
    "url": {
      "raw": "{{baseUrl}}/v2.1/accounts/{{accountId}}/settings/tabs",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "v2.1",
        "accounts",
        "{{accountId}}",
        "settings",
        "tabs"
      ],
      "variable": [
        {
          "key": "accountId",
          "value": "{{accountId}}"
        }
      ]
    }
  },
  "response": [
  ]
}