Chilkat Online Tools

VB.NET / DocuSign Click API / 18. Send Envelope with Template

Back to Collection Items

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

Dim http As New Chilkat.Http
Dim success As Boolean

' Use this online tool to generate code from sample JSON: Generate Code to Create JSON

' The following JSON is sent in the request body.

' {
'   "emailBlurb": "Create an envelope with a templateId",
'   "emailSubject": "Template",
'   "templateId": "{{templateId}}",
'   "status": "sent"
' }

Dim json As New Chilkat.JsonObject
json.UpdateString("emailBlurb","Create an envelope with a templateId")
json.UpdateString("emailSubject","Template")
json.UpdateString("templateId","{{templateId}}")
json.UpdateString("status","sent")

' Adds the "Authorization: Bearer {{accessToken}}" header.
http.AuthToken = "{{accessToken}}"

Dim resp As Chilkat.HttpResponse = http.PostJson3("https://domain.com/{{apiVersion}}/accounts/{{accountId}}/envelopes","application/json",json)
If (http.LastMethodSuccess = False) Then
    Debug.WriteLine(http.LastErrorText)
    Exit Sub
End If


Debug.WriteLine(resp.StatusCode)
Debug.WriteLine(resp.BodyStr)

Curl Command

curl -X POST
	-H "Authorization: Bearer {{accessToken}}"
	-d '{
    "emailBlurb": "Create an envelope with a templateId",
    "emailSubject": "Template",
    "templateId": "{{templateId}}",
    "status": "sent"
}'
https://domain.com/{{apiVersion}}/accounts/{{accountId}}/envelopes

Postman Collection Item JSON

{
  "name": "18. Send Envelope with Template",
  "request": {
    "method": "POST",
    "header": [
      {
        "key": "Authorization",
        "value": "Bearer {{accessToken}}"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n    \"emailBlurb\": \"Create an envelope with a templateId\",\n    \"emailSubject\": \"Template\",\n    \"templateId\": \"{{templateId}}\",\n    \"status\": \"sent\"\n}"
    },
    "url": {
      "raw": "{{baseUrl}}/{{apiVersion}}/accounts/{{accountId}}/envelopes",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "{{apiVersion}}",
        "accounts",
        "{{accountId}}",
        "envelopes"
      ]
    },
    "description": "Send an envelop with a single template."
  },
  "response": [
  ]
}