Chilkat Online Tools

unicodeC / DocuSign REST API / Update Consumer Disclosure.

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.

    // {
    //   "companyName": "sample string 1",
    //   "companyPhone": "sample string 2",
    //   "withdrawEmail": "sample string 3",
    //   "withdrawByEmail": "sample string 4",
    //   "withdrawByPhone": "sample string 5",
    //   "withdrawByMail": "sample string 6",
    //   "withdrawAddressLine1": "sample string 7",
    //   "withdrawAddressLine2": "sample string 8",
    //   "withdrawCity": "sample string 9",
    //   "withdrawState": "sample string 10",
    //   "withdrawPostalCode": "sample string 11",
    //   "withdrawConsequences": "sample string 12",
    //   "withdrawOther": "sample string 13",
    //   "withdrawPhone": "sample string 14",
    //   "changeEmail": "sample string 15",
    //   "changeEmailOther": "sample string 16",
    //   "copyCostPerPage": "sample string 17",
    //   "copyRequestEmail": "sample string 18",
    //   "copyFeeCollectionMethod": "sample string 19",
    //   "custom": "sample string 20",
    //   "pdfId": "sample string 21",
    //   "enableEsign": "sample string 22",
    //   "useBrand": "sample string 23",
    //   "esignAgreement": "sample string 24",
    //   "esignText": "sample string 25",
    //   "allowCDWithdraw": "sample string 26",
    //   "mustAgreeToEsign": "sample string 27",
    //   "useConsumerDisclosureWithinAccount": "sample string 28"
    // }

    json = CkJsonObjectW_Create();
    CkJsonObjectW_UpdateString(json,L"companyName",L"sample string 1");
    CkJsonObjectW_UpdateString(json,L"companyPhone",L"sample string 2");
    CkJsonObjectW_UpdateString(json,L"withdrawEmail",L"sample string 3");
    CkJsonObjectW_UpdateString(json,L"withdrawByEmail",L"sample string 4");
    CkJsonObjectW_UpdateString(json,L"withdrawByPhone",L"sample string 5");
    CkJsonObjectW_UpdateString(json,L"withdrawByMail",L"sample string 6");
    CkJsonObjectW_UpdateString(json,L"withdrawAddressLine1",L"sample string 7");
    CkJsonObjectW_UpdateString(json,L"withdrawAddressLine2",L"sample string 8");
    CkJsonObjectW_UpdateString(json,L"withdrawCity",L"sample string 9");
    CkJsonObjectW_UpdateString(json,L"withdrawState",L"sample string 10");
    CkJsonObjectW_UpdateString(json,L"withdrawPostalCode",L"sample string 11");
    CkJsonObjectW_UpdateString(json,L"withdrawConsequences",L"sample string 12");
    CkJsonObjectW_UpdateString(json,L"withdrawOther",L"sample string 13");
    CkJsonObjectW_UpdateString(json,L"withdrawPhone",L"sample string 14");
    CkJsonObjectW_UpdateString(json,L"changeEmail",L"sample string 15");
    CkJsonObjectW_UpdateString(json,L"changeEmailOther",L"sample string 16");
    CkJsonObjectW_UpdateString(json,L"copyCostPerPage",L"sample string 17");
    CkJsonObjectW_UpdateString(json,L"copyRequestEmail",L"sample string 18");
    CkJsonObjectW_UpdateString(json,L"copyFeeCollectionMethod",L"sample string 19");
    CkJsonObjectW_UpdateString(json,L"custom",L"sample string 20");
    CkJsonObjectW_UpdateString(json,L"pdfId",L"sample string 21");
    CkJsonObjectW_UpdateString(json,L"enableEsign",L"sample string 22");
    CkJsonObjectW_UpdateString(json,L"useBrand",L"sample string 23");
    CkJsonObjectW_UpdateString(json,L"esignAgreement",L"sample string 24");
    CkJsonObjectW_UpdateString(json,L"esignText",L"sample string 25");
    CkJsonObjectW_UpdateString(json,L"allowCDWithdraw",L"sample string 26");
    CkJsonObjectW_UpdateString(json,L"mustAgreeToEsign",L"sample string 27");
    CkJsonObjectW_UpdateString(json,L"useConsumerDisclosureWithinAccount",L"sample string 28");

    // 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}}/consumer_disclosure/{{langCode}}?include_metadata={{include_metadata}}",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 '{
  "companyName": "sample string 1",
  "companyPhone": "sample string 2",
  "withdrawEmail": "sample string 3",
  "withdrawByEmail": "sample string 4",
  "withdrawByPhone": "sample string 5",
  "withdrawByMail": "sample string 6",
  "withdrawAddressLine1": "sample string 7",
  "withdrawAddressLine2": "sample string 8",
  "withdrawCity": "sample string 9",
  "withdrawState": "sample string 10",
  "withdrawPostalCode": "sample string 11",
  "withdrawConsequences": "sample string 12",
  "withdrawOther": "sample string 13",
  "withdrawPhone": "sample string 14",
  "changeEmail": "sample string 15",
  "changeEmailOther": "sample string 16",
  "copyCostPerPage": "sample string 17",
  "copyRequestEmail": "sample string 18",
  "copyFeeCollectionMethod": "sample string 19",
  "custom": "sample string 20",
  "pdfId": "sample string 21",
  "enableEsign": "sample string 22",
  "useBrand": "sample string 23",
  "esignAgreement": "sample string 24",
  "esignText": "sample string 25",
  "allowCDWithdraw": "sample string 26",
  "mustAgreeToEsign": "sample string 27",
  "useConsumerDisclosureWithinAccount": "sample string 28"
}'
https://domain.com/v2.1/accounts/{{accountId}}/consumer_disclosure/{{langCode}}?include_metadata={{include_metadata}}

Postman Collection Item JSON

{
  "name": "Update Consumer Disclosure.",
  "request": {
    "method": "PUT",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      },
      {
        "key": "Authorization",
        "value": "Bearer {{accessToken}}"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n  \"companyName\": \"sample string 1\",\n  \"companyPhone\": \"sample string 2\",\n  \"withdrawEmail\": \"sample string 3\",\n  \"withdrawByEmail\": \"sample string 4\",\n  \"withdrawByPhone\": \"sample string 5\",\n  \"withdrawByMail\": \"sample string 6\",\n  \"withdrawAddressLine1\": \"sample string 7\",\n  \"withdrawAddressLine2\": \"sample string 8\",\n  \"withdrawCity\": \"sample string 9\",\n  \"withdrawState\": \"sample string 10\",\n  \"withdrawPostalCode\": \"sample string 11\",\n  \"withdrawConsequences\": \"sample string 12\",\n  \"withdrawOther\": \"sample string 13\",\n  \"withdrawPhone\": \"sample string 14\",\n  \"changeEmail\": \"sample string 15\",\n  \"changeEmailOther\": \"sample string 16\",\n  \"copyCostPerPage\": \"sample string 17\",\n  \"copyRequestEmail\": \"sample string 18\",\n  \"copyFeeCollectionMethod\": \"sample string 19\",\n  \"custom\": \"sample string 20\",\n  \"pdfId\": \"sample string 21\",\n  \"enableEsign\": \"sample string 22\",\n  \"useBrand\": \"sample string 23\",\n  \"esignAgreement\": \"sample string 24\",\n  \"esignText\": \"sample string 25\",\n  \"allowCDWithdraw\": \"sample string 26\",\n  \"mustAgreeToEsign\": \"sample string 27\",\n  \"useConsumerDisclosureWithinAccount\": \"sample string 28\"\n}"
    },
    "url": {
      "raw": "{{baseUrl}}/v2.1/accounts/{{accountId}}/consumer_disclosure/{{langCode}}?include_metadata={{include_metadata}}",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "v2.1",
        "accounts",
        "{{accountId}}",
        "consumer_disclosure",
        "{{langCode}}"
      ],
      "query": [
        {
          "key": "include_metadata",
          "value": "{{include_metadata}}"
        }
      ],
      "variable": [
        {
          "key": "accountId",
          "value": "{{accountId}}"
        },
        {
          "key": "langCode",
          "value": "{{langCode}}"
        }
      ]
    }
  },
  "response": [
  ]
}