Chilkat Online Tools

C / DocuSign eSignature REST API / Gets status changes for one or more envelopes.

Back to Collection Items

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

void ChilkatSample(void)
    {
    HCkHttp http;
    BOOL success;
    HCkJsonObject queryParams;
    HCkHttpResponse resp;

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

    http = CkHttp_Create();

    queryParams = CkJsonObject_Create();
    CkJsonObject_UpdateString(queryParams,"ac_status","{{ac_status}}");
    CkJsonObject_UpdateString(queryParams,"block","{{block}}");
    CkJsonObject_UpdateString(queryParams,"cdse_mode","{{cdse_mode}}");
    CkJsonObject_UpdateString(queryParams,"continuation_token","{{continuation_token}}");
    CkJsonObject_UpdateString(queryParams,"count","{{count}}");
    CkJsonObject_UpdateString(queryParams,"custom_field","{{custom_field}}");
    CkJsonObject_UpdateString(queryParams,"email","{{email}}");
    CkJsonObject_UpdateString(queryParams,"envelope_ids","{{envelope_ids}}");
    CkJsonObject_UpdateString(queryParams,"exclude","{{exclude}}");
    CkJsonObject_UpdateString(queryParams,"folder_ids","{{folder_ids}}");
    CkJsonObject_UpdateString(queryParams,"folder_types","{{folder_types}}");
    CkJsonObject_UpdateString(queryParams,"from_date","{{from_date}}");
    CkJsonObject_UpdateString(queryParams,"from_to_status","{{from_to_status}}");
    CkJsonObject_UpdateString(queryParams,"include","{{include}}");
    CkJsonObject_UpdateString(queryParams,"include_purge_information","{{include_purge_information}}");
    CkJsonObject_UpdateString(queryParams,"intersecting_folder_ids","{{intersecting_folder_ids}}");
    CkJsonObject_UpdateString(queryParams,"last_queried_date","{{last_queried_date}}");
    CkJsonObject_UpdateString(queryParams,"order","{{order}}");
    CkJsonObject_UpdateString(queryParams,"order_by","{{order_by}}");
    CkJsonObject_UpdateString(queryParams,"powerformids","{{powerformids}}");
    CkJsonObject_UpdateString(queryParams,"query_budget","{{query_budget}}");
    CkJsonObject_UpdateString(queryParams,"requester_date_format","{{requester_date_format}}");
    CkJsonObject_UpdateString(queryParams,"search_text","{{search_text}}");
    CkJsonObject_UpdateString(queryParams,"start_position","{{start_position}}");
    CkJsonObject_UpdateString(queryParams,"status","{{status}}");
    CkJsonObject_UpdateString(queryParams,"to_date","{{to_date}}");
    CkJsonObject_UpdateString(queryParams,"transaction_ids","{{transaction_ids}}");
    CkJsonObject_UpdateString(queryParams,"user_filter","{{user_filter}}");
    CkJsonObject_UpdateString(queryParams,"user_id","{{user_id}}");
    CkJsonObject_UpdateString(queryParams,"user_name","{{user_name}}");

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

    resp = CkHttp_QuickRequestParams(http,"GET","https://domain.com/v2.1/accounts/{{accountId}}/envelopes",queryParams);
    if (CkHttp_getLastMethodSuccess(http) == FALSE) {
        printf("%s\n",CkHttp_lastErrorText(http));
        CkHttp_Dispose(http);
        CkJsonObject_Dispose(queryParams);
        return;
    }

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


    CkHttp_Dispose(http);
    CkJsonObject_Dispose(queryParams);

    }

Curl Command

curl -G -d "ac_status=%7B%7Bac_status%7D%7D"
	-d "block=%7B%7Bblock%7D%7D"
	-d "cdse_mode=%7B%7Bcdse_mode%7D%7D"
	-d "continuation_token=%7B%7Bcontinuation_token%7D%7D"
	-d "count=%7B%7Bcount%7D%7D"
	-d "custom_field=%7B%7Bcustom_field%7D%7D"
	-d "email=%7B%7Bemail%7D%7D"
	-d "envelope_ids=%7B%7Benvelope_ids%7D%7D"
	-d "exclude=%7B%7Bexclude%7D%7D"
	-d "folder_ids=%7B%7Bfolder_ids%7D%7D"
	-d "folder_types=%7B%7Bfolder_types%7D%7D"
	-d "from_date=%7B%7Bfrom_date%7D%7D"
	-d "from_to_status=%7B%7Bfrom_to_status%7D%7D"
	-d "include=%7B%7Binclude%7D%7D"
	-d "include_purge_information=%7B%7Binclude_purge_information%7D%7D"
	-d "intersecting_folder_ids=%7B%7Bintersecting_folder_ids%7D%7D"
	-d "last_queried_date=%7B%7Blast_queried_date%7D%7D"
	-d "order=%7B%7Border%7D%7D"
	-d "order_by=%7B%7Border_by%7D%7D"
	-d "powerformids=%7B%7Bpowerformids%7D%7D"
	-d "query_budget=%7B%7Bquery_budget%7D%7D"
	-d "requester_date_format=%7B%7Brequester_date_format%7D%7D"
	-d "search_text=%7B%7Bsearch_text%7D%7D"
	-d "start_position=%7B%7Bstart_position%7D%7D"
	-d "status=%7B%7Bstatus%7D%7D"
	-d "to_date=%7B%7Bto_date%7D%7D"
	-d "transaction_ids=%7B%7Btransaction_ids%7D%7D"
	-d "user_filter=%7B%7Buser_filter%7D%7D"
	-d "user_id=%7B%7Buser_id%7D%7D"
	-d "user_name=%7B%7Buser_name%7D%7D"
	-H "Accept: application/json"
	-H "Authorization: Bearer {{accessToken}}"
https://domain.com/v2.1/accounts/{{accountId}}/envelopes

Postman Collection Item JSON

{
  "name": "Gets status changes for one or more envelopes.",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      },
      {
        "key": "Authorization",
        "value": "Bearer {{accessToken}}"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/v2.1/accounts/{{accountId}}/envelopes?ac_status={{ac_status}}&block={{block}}&cdse_mode={{cdse_mode}}&continuation_token={{continuation_token}}&count={{count}}&custom_field={{custom_field}}&email={{email}}&envelope_ids={{envelope_ids}}&exclude={{exclude}}&folder_ids={{folder_ids}}&folder_types={{folder_types}}&from_date={{from_date}}&from_to_status={{from_to_status}}&include={{include}}&include_purge_information={{include_purge_information}}&intersecting_folder_ids={{intersecting_folder_ids}}&last_queried_date={{last_queried_date}}&order={{order}}&order_by={{order_by}}&powerformids={{powerformids}}&query_budget={{query_budget}}&requester_date_format={{requester_date_format}}&search_text={{search_text}}&start_position={{start_position}}&status={{status}}&to_date={{to_date}}&transaction_ids={{transaction_ids}}&user_filter={{user_filter}}&user_id={{user_id}}&user_name={{user_name}}",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "v2.1",
        "accounts",
        "{{accountId}}",
        "envelopes"
      ],
      "query": [
        {
          "key": "ac_status",
          "value": "{{ac_status}}"
        },
        {
          "key": "block",
          "value": "{{block}}"
        },
        {
          "key": "cdse_mode",
          "value": "{{cdse_mode}}"
        },
        {
          "key": "continuation_token",
          "value": "{{continuation_token}}"
        },
        {
          "key": "count",
          "value": "{{count}}"
        },
        {
          "key": "custom_field",
          "value": "{{custom_field}}"
        },
        {
          "key": "email",
          "value": "{{email}}"
        },
        {
          "key": "envelope_ids",
          "value": "{{envelope_ids}}"
        },
        {
          "key": "exclude",
          "value": "{{exclude}}"
        },
        {
          "key": "folder_ids",
          "value": "{{folder_ids}}"
        },
        {
          "key": "folder_types",
          "value": "{{folder_types}}"
        },
        {
          "key": "from_date",
          "value": "{{from_date}}"
        },
        {
          "key": "from_to_status",
          "value": "{{from_to_status}}"
        },
        {
          "key": "include",
          "value": "{{include}}"
        },
        {
          "key": "include_purge_information",
          "value": "{{include_purge_information}}"
        },
        {
          "key": "intersecting_folder_ids",
          "value": "{{intersecting_folder_ids}}"
        },
        {
          "key": "last_queried_date",
          "value": "{{last_queried_date}}"
        },
        {
          "key": "order",
          "value": "{{order}}"
        },
        {
          "key": "order_by",
          "value": "{{order_by}}"
        },
        {
          "key": "powerformids",
          "value": "{{powerformids}}"
        },
        {
          "key": "query_budget",
          "value": "{{query_budget}}"
        },
        {
          "key": "requester_date_format",
          "value": "{{requester_date_format}}"
        },
        {
          "key": "search_text",
          "value": "{{search_text}}"
        },
        {
          "key": "start_position",
          "value": "{{start_position}}"
        },
        {
          "key": "status",
          "value": "{{status}}"
        },
        {
          "key": "to_date",
          "value": "{{to_date}}"
        },
        {
          "key": "transaction_ids",
          "value": "{{transaction_ids}}"
        },
        {
          "key": "user_filter",
          "value": "{{user_filter}}"
        },
        {
          "key": "user_id",
          "value": "{{user_id}}"
        },
        {
          "key": "user_name",
          "value": "{{user_name}}"
        }
      ],
      "variable": [
        {
          "key": "accountId",
          "value": "{{accountId}}",
          "type": "string"
        }
      ]
    },
    "description": "Retrieves envelope status changes for all envelopes. You can modify the information returned by adding query strings to limit the request to check between certain dates and times, or for certain envelopes, or for certain status codes. It is recommended that you use one or more of the query strings in order to limit the size of the response.\n\n### Important: Unless you are requesting the status for specific envelopes (using the `envelopeIds` or `transactionIds` properties), you must add a set the `from_date` property in the request.\n\nGetting envelope status using `transactionIds` is useful for offline signing situations where it can be used determine if an envelope was created or not, for the cases where a network connection was lost, before the envelope status could be returned.\n\n### Request Envelope Status Notes ###\n\nThe REST API GET /envelopes call uses certain filters to find results. In some cases requests are check for \"any status change\" instead of the just the single status requested. In these cases, more envelopes might be returned by the request than otherwise would be. For example, for a request with the begin date is set to Jan 1st, an end date set to Jan 7th and the status qualifier (`from_to_status`) set to `Delivered` &mdash; the response set might contain envelopes that were created during that time period, but not delivered during the time period.\n\nTo avoid unnecessary database queries, the DocuSign system checks requests to ensure that the added filters will not result in a zero-size response before acting on the request. The following table shows the valid envelope statuses (in the Valid Current Statuses column) for the status qualifiers in the request. If the status and status qualifiers in the API request do not contain any of the values shown in the valid current statuses column, then an empty list is returned.\n\nFor example, a request with a status qualifier (from_to_status) of `Delivered` and a status of \"`Created`,`Sent`\", DocuSign will always return an empty list. This is because the request essentially translates to: find the envelopes that were delivered between the begin and end dates that have a current status of `Created` or `Sent`, and since an envelope that has been delivered can never have a status of `Created` or `Sent`, a zero-size response would be generated. In this case, DocuSign does not run the request, but just returns the empty list.\n\nClient applications should check that the statuses they are requesting make sense for a given status qualifier."
  },
  "response": [
  ]
}