Chilkat Online Tools

C / DocuSign REST API / Updates custom tab information.

Back to Collection Items

#include <C_CkHttp.h>
#include <C_CkJsonObject.h>
#include <C_CkStringBuilder.h>
#include <C_CkHttpResponse.h>

void ChilkatSample(void)
    {
    HCkHttp http;
    BOOL success;
    HCkJsonObject json;
    HCkStringBuilder sbRequestBody;
    HCkHttpResponse resp;

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

    http = CkHttp_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.

    // {
    //   "font": "sample string 1",
    //   "bold": "sample string 2",
    //   "italic": "sample string 3",
    //   "underline": "sample string 4",
    //   "fontColor": "sample string 5",
    //   "fontSize": "sample string 6",
    //   "anchor": "sample string 7",
    //   "anchorXOffset": "sample string 8",
    //   "anchorYOffset": "sample string 9",
    //   "anchorUnits": "sample string 10",
    //   "anchorIgnoreIfNotPresent": "sample string 11",
    //   "anchorMatchWholeWord": "sample string 12",
    //   "anchorCaseSensitive": "sample string 13",
    //   "anchorHorizontalAlignment": "sample string 14",
    //   "paymentItemCode": "sample string 15",
    //   "paymentItemDescription": "sample string 16",
    //   "paymentItemName": "sample string 17",
    //   "height": "sample string 18",
    //   "width": "sample string 19",
    //   "customTabId": "sample string 20",
    //   "initialValue": "sample string 21",
    //   "includedInEmail": "sample string 22",
    //   "disableAutoSize": "sample string 23",
    //   "concealValueOnDocument": "sample string 24",
    //   "locked": "sample string 25",
    //   "required": "sample string 26",
    //   "shared": "sample string 27",
    //   "collaborative": "sample string 28",
    //   "requireInitialOnSharedChange": "sample string 29",
    //   "requireAll": "sample string 30",
    //   "items": [
    //     "sample string 1"
    //   ],
    //   "tabLabel": "sample string 31",
    //   "maximumLength": "sample string 32",
    //   "scaleValue": "sample string 33",
    //   "name": "sample string 34",
    //   "type": "sample string 35",
    //   "validationMessage": "sample string 36",
    //   "validationPattern": "sample string 37",
    //   "lastModifiedByUserId": "sample string 38",
    //   "lastModifiedByDisplayName": "sample string 39",
    //   "lastModified": "sample string 40",
    //   "createdByUserId": "sample string 41",
    //   "createdByDisplayName": "sample string 42",
    //   "editable": "sample string 43",
    //   "mergeField": {
    //     "configurationType": "sample string 1",
    //     "path": "sample string 2",
    //     "writeBack": "sample string 3",
    //     "allowSenderToEdit": "sample string 4",
    //     "row": "sample string 5"
    //   },
    //   "stampType": "sample string 44",
    //   "selected": "sample string 45"
    // }

    json = CkJsonObject_Create();
    CkJsonObject_UpdateString(json,"font","sample string 1");
    CkJsonObject_UpdateString(json,"bold","sample string 2");
    CkJsonObject_UpdateString(json,"italic","sample string 3");
    CkJsonObject_UpdateString(json,"underline","sample string 4");
    CkJsonObject_UpdateString(json,"fontColor","sample string 5");
    CkJsonObject_UpdateString(json,"fontSize","sample string 6");
    CkJsonObject_UpdateString(json,"anchor","sample string 7");
    CkJsonObject_UpdateString(json,"anchorXOffset","sample string 8");
    CkJsonObject_UpdateString(json,"anchorYOffset","sample string 9");
    CkJsonObject_UpdateString(json,"anchorUnits","sample string 10");
    CkJsonObject_UpdateString(json,"anchorIgnoreIfNotPresent","sample string 11");
    CkJsonObject_UpdateString(json,"anchorMatchWholeWord","sample string 12");
    CkJsonObject_UpdateString(json,"anchorCaseSensitive","sample string 13");
    CkJsonObject_UpdateString(json,"anchorHorizontalAlignment","sample string 14");
    CkJsonObject_UpdateString(json,"paymentItemCode","sample string 15");
    CkJsonObject_UpdateString(json,"paymentItemDescription","sample string 16");
    CkJsonObject_UpdateString(json,"paymentItemName","sample string 17");
    CkJsonObject_UpdateString(json,"height","sample string 18");
    CkJsonObject_UpdateString(json,"width","sample string 19");
    CkJsonObject_UpdateString(json,"customTabId","sample string 20");
    CkJsonObject_UpdateString(json,"initialValue","sample string 21");
    CkJsonObject_UpdateString(json,"includedInEmail","sample string 22");
    CkJsonObject_UpdateString(json,"disableAutoSize","sample string 23");
    CkJsonObject_UpdateString(json,"concealValueOnDocument","sample string 24");
    CkJsonObject_UpdateString(json,"locked","sample string 25");
    CkJsonObject_UpdateString(json,"required","sample string 26");
    CkJsonObject_UpdateString(json,"shared","sample string 27");
    CkJsonObject_UpdateString(json,"collaborative","sample string 28");
    CkJsonObject_UpdateString(json,"requireInitialOnSharedChange","sample string 29");
    CkJsonObject_UpdateString(json,"requireAll","sample string 30");
    CkJsonObject_UpdateString(json,"items[0]","sample string 1");
    CkJsonObject_UpdateString(json,"tabLabel","sample string 31");
    CkJsonObject_UpdateString(json,"maximumLength","sample string 32");
    CkJsonObject_UpdateString(json,"scaleValue","sample string 33");
    CkJsonObject_UpdateString(json,"name","sample string 34");
    CkJsonObject_UpdateString(json,"type","sample string 35");
    CkJsonObject_UpdateString(json,"validationMessage","sample string 36");
    CkJsonObject_UpdateString(json,"validationPattern","sample string 37");
    CkJsonObject_UpdateString(json,"lastModifiedByUserId","sample string 38");
    CkJsonObject_UpdateString(json,"lastModifiedByDisplayName","sample string 39");
    CkJsonObject_UpdateString(json,"lastModified","sample string 40");
    CkJsonObject_UpdateString(json,"createdByUserId","sample string 41");
    CkJsonObject_UpdateString(json,"createdByDisplayName","sample string 42");
    CkJsonObject_UpdateString(json,"editable","sample string 43");
    CkJsonObject_UpdateString(json,"mergeField.configurationType","sample string 1");
    CkJsonObject_UpdateString(json,"mergeField.path","sample string 2");
    CkJsonObject_UpdateString(json,"mergeField.writeBack","sample string 3");
    CkJsonObject_UpdateString(json,"mergeField.allowSenderToEdit","sample string 4");
    CkJsonObject_UpdateString(json,"mergeField.row","sample string 5");
    CkJsonObject_UpdateString(json,"stampType","sample string 44");
    CkJsonObject_UpdateString(json,"selected","sample string 45");

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

    sbRequestBody = CkStringBuilder_Create();
    CkJsonObject_EmitSb(json,sbRequestBody);

    resp = CkHttp_PTextSb(http,"PUT","https://domain.com/v2.1/accounts/{{accountId}}/tab_definitions/{{customTabId}}",sbRequestBody,"utf-8","application/json",FALSE,FALSE);
    if (CkHttp_getLastMethodSuccess(http) == FALSE) {
        printf("%s\n",CkHttp_lastErrorText(http));
        CkHttp_Dispose(http);
        CkJsonObject_Dispose(json);
        CkStringBuilder_Dispose(sbRequestBody);
        return;
    }

    printf("%d\n",CkHttpResponse_getStatusCode(resp));
    printf("%s\n",CkHttpResponse_bodyStr(resp));
    CkHttpResponse_Dispose(resp);


    CkHttp_Dispose(http);
    CkJsonObject_Dispose(json);
    CkStringBuilder_Dispose(sbRequestBody);

    }

Curl Command

curl -X PUT
	-H "Accept: application/json"
	-H "Authorization: Bearer {{accessToken}}"
	-d '{
  "font": "sample string 1",
  "bold": "sample string 2",
  "italic": "sample string 3",
  "underline": "sample string 4",
  "fontColor": "sample string 5",
  "fontSize": "sample string 6",
  "anchor": "sample string 7",
  "anchorXOffset": "sample string 8",
  "anchorYOffset": "sample string 9",
  "anchorUnits": "sample string 10",
  "anchorIgnoreIfNotPresent": "sample string 11",
  "anchorMatchWholeWord": "sample string 12",
  "anchorCaseSensitive": "sample string 13",
  "anchorHorizontalAlignment": "sample string 14",
  "paymentItemCode": "sample string 15",
  "paymentItemDescription": "sample string 16",
  "paymentItemName": "sample string 17",
  "height": "sample string 18",
  "width": "sample string 19",
  "customTabId": "sample string 20",
  "initialValue": "sample string 21",
  "includedInEmail": "sample string 22",
  "disableAutoSize": "sample string 23",
  "concealValueOnDocument": "sample string 24",
  "locked": "sample string 25",
  "required": "sample string 26",
  "shared": "sample string 27",
  "collaborative": "sample string 28",
  "requireInitialOnSharedChange": "sample string 29",
  "requireAll": "sample string 30",
  "items": [
    "sample string 1"
  ],
  "tabLabel": "sample string 31",
  "maximumLength": "sample string 32",
  "scaleValue": "sample string 33",
  "name": "sample string 34",
  "type": "sample string 35",
  "validationMessage": "sample string 36",
  "validationPattern": "sample string 37",
  "lastModifiedByUserId": "sample string 38",
  "lastModifiedByDisplayName": "sample string 39",
  "lastModified": "sample string 40",
  "createdByUserId": "sample string 41",
  "createdByDisplayName": "sample string 42",
  "editable": "sample string 43",
  "mergeField": {
    "configurationType": "sample string 1",
    "path": "sample string 2",
    "writeBack": "sample string 3",
    "allowSenderToEdit": "sample string 4",
    "row": "sample string 5"
  },
  "stampType": "sample string 44",
  "selected": "sample string 45"
}'
https://domain.com/v2.1/accounts/{{accountId}}/tab_definitions/{{customTabId}}

Postman Collection Item JSON

{
  "name": "Updates custom tab information.\n\n",
  "request": {
    "method": "PUT",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      },
      {
        "key": "Authorization",
        "value": "Bearer {{accessToken}}"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n  \"font\": \"sample string 1\",\n  \"bold\": \"sample string 2\",\n  \"italic\": \"sample string 3\",\n  \"underline\": \"sample string 4\",\n  \"fontColor\": \"sample string 5\",\n  \"fontSize\": \"sample string 6\",\n  \"anchor\": \"sample string 7\",\n  \"anchorXOffset\": \"sample string 8\",\n  \"anchorYOffset\": \"sample string 9\",\n  \"anchorUnits\": \"sample string 10\",\n  \"anchorIgnoreIfNotPresent\": \"sample string 11\",\n  \"anchorMatchWholeWord\": \"sample string 12\",\n  \"anchorCaseSensitive\": \"sample string 13\",\n  \"anchorHorizontalAlignment\": \"sample string 14\",\n  \"paymentItemCode\": \"sample string 15\",\n  \"paymentItemDescription\": \"sample string 16\",\n  \"paymentItemName\": \"sample string 17\",\n  \"height\": \"sample string 18\",\n  \"width\": \"sample string 19\",\n  \"customTabId\": \"sample string 20\",\n  \"initialValue\": \"sample string 21\",\n  \"includedInEmail\": \"sample string 22\",\n  \"disableAutoSize\": \"sample string 23\",\n  \"concealValueOnDocument\": \"sample string 24\",\n  \"locked\": \"sample string 25\",\n  \"required\": \"sample string 26\",\n  \"shared\": \"sample string 27\",\n  \"collaborative\": \"sample string 28\",\n  \"requireInitialOnSharedChange\": \"sample string 29\",\n  \"requireAll\": \"sample string 30\",\n  \"items\": [\n    \"sample string 1\"\n  ],\n  \"tabLabel\": \"sample string 31\",\n  \"maximumLength\": \"sample string 32\",\n  \"scaleValue\": \"sample string 33\",\n  \"name\": \"sample string 34\",\n  \"type\": \"sample string 35\",\n  \"validationMessage\": \"sample string 36\",\n  \"validationPattern\": \"sample string 37\",\n  \"lastModifiedByUserId\": \"sample string 38\",\n  \"lastModifiedByDisplayName\": \"sample string 39\",\n  \"lastModified\": \"sample string 40\",\n  \"createdByUserId\": \"sample string 41\",\n  \"createdByDisplayName\": \"sample string 42\",\n  \"editable\": \"sample string 43\",\n  \"mergeField\": {\n    \"configurationType\": \"sample string 1\",\n    \"path\": \"sample string 2\",\n    \"writeBack\": \"sample string 3\",\n    \"allowSenderToEdit\": \"sample string 4\",\n    \"row\": \"sample string 5\"\n  },\n  \"stampType\": \"sample string 44\",\n  \"selected\": \"sample string 45\"\n}"
    },
    "url": {
      "raw": "{{baseUrl}}/v2.1/accounts/{{accountId}}/tab_definitions/{{customTabId}}",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "v2.1",
        "accounts",
        "{{accountId}}",
        "tab_definitions",
        "{{customTabId}}"
      ],
      "variable": [
        {
          "key": "accountId",
          "value": "{{accountId}}"
        },
        {
          "key": "customTabId",
          "value": "{{customTabId}}"
        }
      ]
    },
    "description": "Updates the information in a custom tab for the specified account."
  },
  "response": [
  ]
}