Chilkat Online Tools

unicodeC / DocuSign eSignature REST API / Gets a page image from a template for display.

Back to Collection Items

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

void ChilkatSample(void)
    {
    HCkHttpW http;
    BOOL success;
    HCkJsonObjectW queryParams;
    HCkHttpResponseW resp;

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

    http = CkHttpW_Create();

    queryParams = CkJsonObjectW_Create();
    CkJsonObjectW_UpdateString(queryParams,L"dpi",L"{{dpi}}");
    CkJsonObjectW_UpdateString(queryParams,L"max_height",L"{{max_height}}");
    CkJsonObjectW_UpdateString(queryParams,L"max_width",L"{{max_width}}");
    CkJsonObjectW_UpdateString(queryParams,L"show_changes",L"{{show_changes}}");

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

    resp = CkHttpW_QuickRequestParams(http,L"GET",L"https://domain.com/v2.1/accounts/{{accountId}}/templates/{{templateId}}/documents/{{documentId}}/pages/{{pageNumber}}/page_image",queryParams);
    if (CkHttpW_getLastMethodSuccess(http) == FALSE) {
        wprintf(L"%s\n",CkHttpW_lastErrorText(http));
        CkHttpW_Dispose(http);
        CkJsonObjectW_Dispose(queryParams);
        return;
    }

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


    CkHttpW_Dispose(http);
    CkJsonObjectW_Dispose(queryParams);

    }

Curl Command

curl -G -d "dpi=%7B%7Bdpi%7D%7D"
	-d "max_height=%7B%7Bmax_height%7D%7D"
	-d "max_width=%7B%7Bmax_width%7D%7D"
	-d "show_changes=%7B%7Bshow_changes%7D%7D"
	-H "Accept: image/png"
	-H "Authorization: Bearer {{accessToken}}"
https://domain.com/v2.1/accounts/{{accountId}}/templates/{{templateId}}/documents/{{documentId}}/pages/{{pageNumber}}/page_image

Postman Collection Item JSON

{
  "name": "Gets a page image from a template for display.",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "image/png"
      },
      {
        "key": "Authorization",
        "value": "Bearer {{accessToken}}"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/v2.1/accounts/{{accountId}}/templates/{{templateId}}/documents/{{documentId}}/pages/{{pageNumber}}/page_image?dpi={{dpi}}&max_height={{max_height}}&max_width={{max_width}}&show_changes={{show_changes}}",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "v2.1",
        "accounts",
        "{{accountId}}",
        "templates",
        "{{templateId}}",
        "documents",
        "{{documentId}}",
        "pages",
        "{{pageNumber}}",
        "page_image"
      ],
      "query": [
        {
          "key": "dpi",
          "value": "{{dpi}}"
        },
        {
          "key": "max_height",
          "value": "{{max_height}}"
        },
        {
          "key": "max_width",
          "value": "{{max_width}}"
        },
        {
          "key": "show_changes",
          "value": "{{show_changes}}"
        }
      ],
      "variable": [
        {
          "key": "accountId",
          "value": "{{accountId}}",
          "type": "string"
        },
        {
          "key": "documentId",
          "value": "{{documentId}}",
          "type": "string"
        },
        {
          "key": "pageNumber",
          "value": "{{pageNumber}}",
          "type": "string"
        },
        {
          "key": "templateId",
          "value": "{{templateId}}",
          "type": "string"
        }
      ]
    },
    "description": "Retrieves a page image for display from the specified template."
  },
  "response": [
  ]
}