Chilkat Online Tools

DataFlex / DocuSign REST API / Gets a document from an envelope.

Back to Collection Items

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vQueryParams
    Handle hoQueryParams
    Variant vResp
    Handle hoResp
    String sTemp1
    Integer iTemp1
    Boolean bTemp1

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

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoQueryParams
    If (Not(IsComObjectCreated(hoQueryParams))) Begin
        Send CreateComObject of hoQueryParams
    End
    Get ComUpdateString Of hoQueryParams "certificate" "{{certificate}}" To iSuccess
    Get ComUpdateString Of hoQueryParams "documents_by_userid" "{{documents_by_userid}}" To iSuccess
    Get ComUpdateString Of hoQueryParams "encoding" "{{encoding}}" To iSuccess
    Get ComUpdateString Of hoQueryParams "encrypt" "{{encrypt}}" To iSuccess
    Get ComUpdateString Of hoQueryParams "language" "{{language}}" To iSuccess
    Get ComUpdateString Of hoQueryParams "recipient_id" "{{recipient_id}}" To iSuccess
    Get ComUpdateString Of hoQueryParams "shared_user_id" "{{shared_user_id}}" To iSuccess
    Get ComUpdateString Of hoQueryParams "show_changes" "{{show_changes}}" To iSuccess
    Get ComUpdateString Of hoQueryParams "watermark" "{{watermark}}" To iSuccess

    // Adds the "Authorization: Bearer {{accessToken}}" header.
    Set ComAuthToken Of hoHttp To "{{accessToken}}"
    Send ComSetRequestHeader To hoHttp "Accept" "application/pdf"

    Get pvComObject of hoQueryParams to vQueryParams
    Get ComQuickRequestParams Of hoHttp "GET" "https://domain.com/v2.1/accounts/{{accountId}}/envelopes/{{envelopeId}}/documents/{{documentId}}" vQueryParams To vResp
    If (IsComObject(vResp)) Begin
        Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
        Set pvComObject Of hoResp To vResp
    End
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComStatusCode Of hoResp To iTemp1
    Showln iTemp1
    Get ComBodyStr Of hoResp To sTemp1
    Showln sTemp1
    Send Destroy of hoResp


End_Procedure

Curl Command

curl -G -d "certificate=%7B%7Bcertificate%7D%7D"
	-d "documents_by_userid=%7B%7Bdocuments_by_userid%7D%7D"
	-d "encoding=%7B%7Bencoding%7D%7D"
	-d "encrypt=%7B%7Bencrypt%7D%7D"
	-d "language=%7B%7Blanguage%7D%7D"
	-d "recipient_id=%7B%7Brecipient_id%7D%7D"
	-d "shared_user_id=%7B%7Bshared_user_id%7D%7D"
	-d "show_changes=%7B%7Bshow_changes%7D%7D"
	-d "watermark=%7B%7Bwatermark%7D%7D"
	-H "Accept: application/pdf"
	-H "Authorization: Bearer {{accessToken}}"
https://domain.com/v2.1/accounts/{{accountId}}/envelopes/{{envelopeId}}/documents/{{documentId}}

Postman Collection Item JSON

{
  "name": "Gets a document from an envelope.",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/pdf"
      },
      {
        "key": "Authorization",
        "value": "Bearer {{accessToken}}"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/v2.1/accounts/{{accountId}}/envelopes/{{envelopeId}}/documents/{{documentId}}?certificate={{certificate}}&documents_by_userid={{documents_by_userid}}&encoding={{encoding}}&encrypt={{encrypt}}&language={{language}}&recipient_id={{recipient_id}}&shared_user_id={{shared_user_id}}&show_changes={{show_changes}}&watermark={{watermark}}",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "v2.1",
        "accounts",
        "{{accountId}}",
        "envelopes",
        "{{envelopeId}}",
        "documents",
        "{{documentId}}"
      ],
      "query": [
        {
          "key": "certificate",
          "value": "{{certificate}}"
        },
        {
          "key": "documents_by_userid",
          "value": "{{documents_by_userid}}"
        },
        {
          "key": "encoding",
          "value": "{{encoding}}"
        },
        {
          "key": "encrypt",
          "value": "{{encrypt}}"
        },
        {
          "key": "language",
          "value": "{{language}}"
        },
        {
          "key": "recipient_id",
          "value": "{{recipient_id}}"
        },
        {
          "key": "shared_user_id",
          "value": "{{shared_user_id}}"
        },
        {
          "key": "show_changes",
          "value": "{{show_changes}}"
        },
        {
          "key": "watermark",
          "value": "{{watermark}}"
        }
      ],
      "variable": [
        {
          "key": "accountId",
          "value": "{{accountId}}"
        },
        {
          "key": "documentId",
          "value": "{{documentId}}"
        },
        {
          "key": "envelopeId",
          "value": "{{envelopeId}}"
        }
      ]
    },
    "description": "Retrieves the specified document from the envelope. If the account has the Highlight Data Changes feature enabled, there is an option to request that any changes in the envelope be highlighted.\n\nYou can also use this method to retrieve a PDF containing the combined content of all documents and the certificate. If the account has the Highlight Data Changes feature enabled, there is an option to request that any changes in the envelope be highlighted. \n\nTo retrieve the combined content replace the `{documentId}` parameter in the endpoint with `combined`.\n/accounts/{accountId}/envelopes/{envelopeId}/documents/combined"
  },
  "response": [
  ]
}