unicodeC / DocuSign eSignature REST API / Get Responsive HTML Preview for a document in an envelope.
Back to Collection Items
#include <C_CkHttpW.h>
#include <C_CkJsonObjectW.h>
#include <C_CkHttpResponseW.h>
void ChilkatSample(void)
{
HCkHttpW http;
BOOL success;
HCkJsonObjectW json;
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.
// {
// "documentId": "sample string 1",
// "documentGuid": "sample string 2",
// "source": "sample string 3",
// "displayAnchors": [
// {
// "startAnchor": "sample string 1",
// "endAnchor": "sample string 2",
// "removeStartAnchor": true,
// "removeEndAnchor": true,
// "caseSensitive": true,
// "displaySettings": {
// "displayLabel": "sample string 1",
// "display": "sample string 2",
// "displayPageNumber": 3,
// "displayOrder": 4,
// "tableStyle": "sample string 5",
// "cellStyle": "sample string 6",
// "inlineOuterStyle": "sample string 7",
// "hideLabelWhenOpened": true,
// "scrollToTopWhenOpened": true,
// "preLabel": "sample string 10",
// "labelWhenOpened": "sample string 11",
// "collapsibleSettings": {
// "containerStyle": "sample string 1",
// "outerLabelAndArrowStyle": "sample string 2",
// "labelStyle": "sample string 3",
// "arrowStyle": "sample string 4",
// "arrowClosed": "sample string 5",
// "arrowOpen": "sample string 6",
// "arrowLocation": "sample string 7",
// "arrowColor": "sample string 8",
// "arrowSize": "sample string 9",
// "onlyArrowIsClickable": true
// }
// }
// }
// ],
// "removeEmptyTags": "sample string 4",
// "headerLabel": "sample string 5",
// "displayAnchorPrefix": "sample string 6",
// "maxScreenWidth": "sample string 7",
// "displayPageNumber": "sample string 8",
// "displayOrder": "sample string 9",
// "showMobileOptimizedToggle": "sample string 10"
// }
json = CkJsonObjectW_Create();
CkJsonObjectW_UpdateString(json,L"documentId",L"sample string 1");
CkJsonObjectW_UpdateString(json,L"documentGuid",L"sample string 2");
CkJsonObjectW_UpdateString(json,L"source",L"sample string 3");
CkJsonObjectW_UpdateString(json,L"displayAnchors[0].startAnchor",L"sample string 1");
CkJsonObjectW_UpdateString(json,L"displayAnchors[0].endAnchor",L"sample string 2");
CkJsonObjectW_UpdateBool(json,L"displayAnchors[0].removeStartAnchor",TRUE);
CkJsonObjectW_UpdateBool(json,L"displayAnchors[0].removeEndAnchor",TRUE);
CkJsonObjectW_UpdateBool(json,L"displayAnchors[0].caseSensitive",TRUE);
CkJsonObjectW_UpdateString(json,L"displayAnchors[0].displaySettings.displayLabel",L"sample string 1");
CkJsonObjectW_UpdateString(json,L"displayAnchors[0].displaySettings.display",L"sample string 2");
CkJsonObjectW_UpdateInt(json,L"displayAnchors[0].displaySettings.displayPageNumber",3);
CkJsonObjectW_UpdateInt(json,L"displayAnchors[0].displaySettings.displayOrder",4);
CkJsonObjectW_UpdateString(json,L"displayAnchors[0].displaySettings.tableStyle",L"sample string 5");
CkJsonObjectW_UpdateString(json,L"displayAnchors[0].displaySettings.cellStyle",L"sample string 6");
CkJsonObjectW_UpdateString(json,L"displayAnchors[0].displaySettings.inlineOuterStyle",L"sample string 7");
CkJsonObjectW_UpdateBool(json,L"displayAnchors[0].displaySettings.hideLabelWhenOpened",TRUE);
CkJsonObjectW_UpdateBool(json,L"displayAnchors[0].displaySettings.scrollToTopWhenOpened",TRUE);
CkJsonObjectW_UpdateString(json,L"displayAnchors[0].displaySettings.preLabel",L"sample string 10");
CkJsonObjectW_UpdateString(json,L"displayAnchors[0].displaySettings.labelWhenOpened",L"sample string 11");
CkJsonObjectW_UpdateString(json,L"displayAnchors[0].displaySettings.collapsibleSettings.containerStyle",L"sample string 1");
CkJsonObjectW_UpdateString(json,L"displayAnchors[0].displaySettings.collapsibleSettings.outerLabelAndArrowStyle",L"sample string 2");
CkJsonObjectW_UpdateString(json,L"displayAnchors[0].displaySettings.collapsibleSettings.labelStyle",L"sample string 3");
CkJsonObjectW_UpdateString(json,L"displayAnchors[0].displaySettings.collapsibleSettings.arrowStyle",L"sample string 4");
CkJsonObjectW_UpdateString(json,L"displayAnchors[0].displaySettings.collapsibleSettings.arrowClosed",L"sample string 5");
CkJsonObjectW_UpdateString(json,L"displayAnchors[0].displaySettings.collapsibleSettings.arrowOpen",L"sample string 6");
CkJsonObjectW_UpdateString(json,L"displayAnchors[0].displaySettings.collapsibleSettings.arrowLocation",L"sample string 7");
CkJsonObjectW_UpdateString(json,L"displayAnchors[0].displaySettings.collapsibleSettings.arrowColor",L"sample string 8");
CkJsonObjectW_UpdateString(json,L"displayAnchors[0].displaySettings.collapsibleSettings.arrowSize",L"sample string 9");
CkJsonObjectW_UpdateBool(json,L"displayAnchors[0].displaySettings.collapsibleSettings.onlyArrowIsClickable",TRUE);
CkJsonObjectW_UpdateString(json,L"removeEmptyTags",L"sample string 4");
CkJsonObjectW_UpdateString(json,L"headerLabel",L"sample string 5");
CkJsonObjectW_UpdateString(json,L"displayAnchorPrefix",L"sample string 6");
CkJsonObjectW_UpdateString(json,L"maxScreenWidth",L"sample string 7");
CkJsonObjectW_UpdateString(json,L"displayPageNumber",L"sample string 8");
CkJsonObjectW_UpdateString(json,L"displayOrder",L"sample string 9");
CkJsonObjectW_UpdateString(json,L"showMobileOptimizedToggle",L"sample string 10");
// Adds the "Authorization: Bearer {{accessToken}}" header.
CkHttpW_putAuthToken(http,L"{{accessToken}}");
CkHttpW_SetRequestHeader(http,L"Accept",L"application/json");
resp = CkHttpW_PostJson3(http,L"https://domain.com/v2.1/accounts/{{accountId}}/envelopes/{{envelopeId}}/documents/{{documentId}}/responsive_html_preview",L"application/json",json);
if (CkHttpW_getLastMethodSuccess(http) == FALSE) {
wprintf(L"%s\n",CkHttpW_lastErrorText(http));
CkHttpW_Dispose(http);
CkJsonObjectW_Dispose(json);
return;
}
wprintf(L"%d\n",CkHttpResponseW_getStatusCode(resp));
wprintf(L"%s\n",CkHttpResponseW_bodyStr(resp));
CkHttpResponseW_Dispose(resp);
CkHttpW_Dispose(http);
CkJsonObjectW_Dispose(json);
}
Curl Command
curl -X POST
-H "Accept: application/json"
-H "Authorization: Bearer {{accessToken}}"
-d '{
"documentId": "sample string 1",
"documentGuid": "sample string 2",
"source": "sample string 3",
"displayAnchors": [
{
"startAnchor": "sample string 1",
"endAnchor": "sample string 2",
"removeStartAnchor": true,
"removeEndAnchor": true,
"caseSensitive": true,
"displaySettings": {
"displayLabel": "sample string 1",
"display": "sample string 2",
"displayPageNumber": 3,
"displayOrder": 4,
"tableStyle": "sample string 5",
"cellStyle": "sample string 6",
"inlineOuterStyle": "sample string 7",
"hideLabelWhenOpened": true,
"scrollToTopWhenOpened": true,
"preLabel": "sample string 10",
"labelWhenOpened": "sample string 11",
"collapsibleSettings": {
"containerStyle": "sample string 1",
"outerLabelAndArrowStyle": "sample string 2",
"labelStyle": "sample string 3",
"arrowStyle": "sample string 4",
"arrowClosed": "sample string 5",
"arrowOpen": "sample string 6",
"arrowLocation": "sample string 7",
"arrowColor": "sample string 8",
"arrowSize": "sample string 9",
"onlyArrowIsClickable": true
}
}
}
],
"removeEmptyTags": "sample string 4",
"headerLabel": "sample string 5",
"displayAnchorPrefix": "sample string 6",
"maxScreenWidth": "sample string 7",
"displayPageNumber": "sample string 8",
"displayOrder": "sample string 9",
"showMobileOptimizedToggle": "sample string 10"
}'
https://domain.com/v2.1/accounts/{{accountId}}/envelopes/{{envelopeId}}/documents/{{documentId}}/responsive_html_preview
Postman Collection Item JSON
{
"name": "Get Responsive HTML Preview for a document in an envelope.",
"request": {
"method": "POST",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Bearer {{accessToken}}"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"documentId\": \"sample string 1\",\n \"documentGuid\": \"sample string 2\",\n \"source\": \"sample string 3\",\n \"displayAnchors\": [\n {\n \"startAnchor\": \"sample string 1\",\n \"endAnchor\": \"sample string 2\",\n \"removeStartAnchor\": true,\n \"removeEndAnchor\": true,\n \"caseSensitive\": true,\n \"displaySettings\": {\n \"displayLabel\": \"sample string 1\",\n \"display\": \"sample string 2\",\n \"displayPageNumber\": 3,\n \"displayOrder\": 4,\n \"tableStyle\": \"sample string 5\",\n \"cellStyle\": \"sample string 6\",\n \"inlineOuterStyle\": \"sample string 7\",\n \"hideLabelWhenOpened\": true,\n \"scrollToTopWhenOpened\": true,\n \"preLabel\": \"sample string 10\",\n \"labelWhenOpened\": \"sample string 11\",\n \"collapsibleSettings\": {\n \"containerStyle\": \"sample string 1\",\n \"outerLabelAndArrowStyle\": \"sample string 2\",\n \"labelStyle\": \"sample string 3\",\n \"arrowStyle\": \"sample string 4\",\n \"arrowClosed\": \"sample string 5\",\n \"arrowOpen\": \"sample string 6\",\n \"arrowLocation\": \"sample string 7\",\n \"arrowColor\": \"sample string 8\",\n \"arrowSize\": \"sample string 9\",\n \"onlyArrowIsClickable\": true\n }\n }\n }\n ],\n \"removeEmptyTags\": \"sample string 4\",\n \"headerLabel\": \"sample string 5\",\n \"displayAnchorPrefix\": \"sample string 6\",\n \"maxScreenWidth\": \"sample string 7\",\n \"displayPageNumber\": \"sample string 8\",\n \"displayOrder\": \"sample string 9\",\n \"showMobileOptimizedToggle\": \"sample string 10\"\n}"
},
"url": {
"raw": "{{baseUrl}}/v2.1/accounts/{{accountId}}/envelopes/{{envelopeId}}/documents/{{documentId}}/responsive_html_preview",
"host": [
"{{baseUrl}}"
],
"path": [
"v2.1",
"accounts",
"{{accountId}}",
"envelopes",
"{{envelopeId}}",
"documents",
"{{documentId}}",
"responsive_html_preview"
],
"variable": [
{
"key": "accountId",
"value": "{{accountId}}",
"type": "string"
},
{
"key": "documentId",
"value": "{{documentId}}",
"type": "string"
},
{
"key": "envelopeId",
"value": "{{envelopeId}}",
"type": "string"
}
]
}
},
"response": [
]
}