Chilkat Online Tools

SQL Server / DocuSign eSignature REST API / Creates a custom tab.

Back to Collection Items

-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @iTmp0 int
    -- Important: Do not use nvarchar(max).  See the warning about using nvarchar(max).
    DECLARE @sTmp0 nvarchar(4000)
    -- This example assumes the Chilkat API to have been previously unlocked.
    -- See Global Unlock Sample for sample code.

    DECLARE @http int
    -- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @success int

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

    -- The following JSON is sent in the request body.

    -- {
    --   "font": "sample string 1",
    --   "bold": "sample string 2",
    --   "italic": "sample string 3",
    --   "underline": "sample string 4",
    --   "fontColor": "sample string 5",
    --   "fontSize": "sample string 6",
    --   "anchor": "sample string 7",
    --   "anchorXOffset": "sample string 8",
    --   "anchorYOffset": "sample string 9",
    --   "anchorUnits": "sample string 10",
    --   "anchorIgnoreIfNotPresent": "sample string 11",
    --   "anchorMatchWholeWord": "sample string 12",
    --   "anchorCaseSensitive": "sample string 13",
    --   "anchorHorizontalAlignment": "sample string 14",
    --   "paymentItemCode": "sample string 15",
    --   "paymentItemDescription": "sample string 16",
    --   "paymentItemName": "sample string 17",
    --   "height": "sample string 18",
    --   "width": "sample string 19",
    --   "customTabId": "sample string 20",
    --   "initialValue": "sample string 21",
    --   "includedInEmail": "sample string 22",
    --   "disableAutoSize": "sample string 23",
    --   "concealValueOnDocument": "sample string 24",
    --   "locked": "sample string 25",
    --   "required": "sample string 26",
    --   "shared": "sample string 27",
    --   "collaborative": "sample string 28",
    --   "items": [
    --     "sample string 1"
    --   ],
    --   "tabLabel": "sample string 29",
    --   "maximumLength": "sample string 30",
    --   "scaleValue": "sample string 31",
    --   "name": "sample string 32",
    --   "type": "sample string 33",
    --   "validationMessage": "sample string 34",
    --   "validationPattern": "sample string 35",
    --   "lastModifiedByUserId": "sample string 36",
    --   "lastModifiedByDisplayName": "sample string 37",
    --   "lastModified": "sample string 38",
    --   "createdByUserId": "sample string 39",
    --   "createdByDisplayName": "sample string 40",
    --   "editable": "sample string 41",
    --   "mergeField": {
    --     "configurationType": "sample string 1",
    --     "path": "sample string 2",
    --     "writeBack": "sample string 3",
    --     "allowSenderToEdit": "sample string 4",
    --     "row": "sample string 5"
    --   },
    --   "stampType": "sample string 42",
    --   "selected": "sample string 43"
    -- }

    DECLARE @json int
    -- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @json OUT

    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'font', 'sample string 1'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'bold', 'sample string 2'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'italic', 'sample string 3'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'underline', 'sample string 4'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'fontColor', 'sample string 5'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'fontSize', 'sample string 6'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'anchor', 'sample string 7'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'anchorXOffset', 'sample string 8'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'anchorYOffset', 'sample string 9'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'anchorUnits', 'sample string 10'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'anchorIgnoreIfNotPresent', 'sample string 11'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'anchorMatchWholeWord', 'sample string 12'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'anchorCaseSensitive', 'sample string 13'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'anchorHorizontalAlignment', 'sample string 14'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'paymentItemCode', 'sample string 15'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'paymentItemDescription', 'sample string 16'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'paymentItemName', 'sample string 17'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'height', 'sample string 18'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'width', 'sample string 19'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customTabId', 'sample string 20'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'initialValue', 'sample string 21'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'includedInEmail', 'sample string 22'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'disableAutoSize', 'sample string 23'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'concealValueOnDocument', 'sample string 24'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'locked', 'sample string 25'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'required', 'sample string 26'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'shared', 'sample string 27'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'collaborative', 'sample string 28'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'items[0]', 'sample string 1'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'tabLabel', 'sample string 29'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'maximumLength', 'sample string 30'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'scaleValue', 'sample string 31'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'name', 'sample string 32'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'type', 'sample string 33'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'validationMessage', 'sample string 34'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'validationPattern', 'sample string 35'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'lastModifiedByUserId', 'sample string 36'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'lastModifiedByDisplayName', 'sample string 37'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'lastModified', 'sample string 38'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'createdByUserId', 'sample string 39'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'createdByDisplayName', 'sample string 40'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'editable', 'sample string 41'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'mergeField.configurationType', 'sample string 1'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'mergeField.path', 'sample string 2'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'mergeField.writeBack', 'sample string 3'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'mergeField.allowSenderToEdit', 'sample string 4'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'mergeField.row', 'sample string 5'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'stampType', 'sample string 42'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'selected', 'sample string 43'

    -- Adds the "Authorization: Bearer {{accessToken}}" header.
    EXEC sp_OASetProperty @http, 'AuthToken', '{{accessToken}}'
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Accept', 'application/json'

    DECLARE @resp int
    EXEC sp_OAMethod @http, 'PostJson3', @resp OUT, 'https://domain.com/v2.1/accounts/{{accountId}}/tab_definitions', 'application/json', @json
    EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
    IF @iTmp0 = 0
      BEGIN
        EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @json
        RETURN
      END

    EXEC sp_OAGetProperty @resp, 'StatusCode', @iTmp0 OUT
    PRINT @iTmp0
    EXEC sp_OAGetProperty @resp, 'BodyStr', @sTmp0 OUT
    PRINT @sTmp0
    EXEC @hr = sp_OADestroy @resp


    EXEC @hr = sp_OADestroy @http
    EXEC @hr = sp_OADestroy @json


END
GO

Curl Command

curl -X POST
	-H "Accept: application/json"
	-H "Authorization: Bearer {{accessToken}}"
	-d '{
  "font": "sample string 1",
  "bold": "sample string 2",
  "italic": "sample string 3",
  "underline": "sample string 4",
  "fontColor": "sample string 5",
  "fontSize": "sample string 6",
  "anchor": "sample string 7",
  "anchorXOffset": "sample string 8",
  "anchorYOffset": "sample string 9",
  "anchorUnits": "sample string 10",
  "anchorIgnoreIfNotPresent": "sample string 11",
  "anchorMatchWholeWord": "sample string 12",
  "anchorCaseSensitive": "sample string 13",
  "anchorHorizontalAlignment": "sample string 14",
  "paymentItemCode": "sample string 15",
  "paymentItemDescription": "sample string 16",
  "paymentItemName": "sample string 17",
  "height": "sample string 18",
  "width": "sample string 19",
  "customTabId": "sample string 20",
  "initialValue": "sample string 21",
  "includedInEmail": "sample string 22",
  "disableAutoSize": "sample string 23",
  "concealValueOnDocument": "sample string 24",
  "locked": "sample string 25",
  "required": "sample string 26",
  "shared": "sample string 27",
  "collaborative": "sample string 28",
  "items": [
    "sample string 1"
  ],
  "tabLabel": "sample string 29",
  "maximumLength": "sample string 30",
  "scaleValue": "sample string 31",
  "name": "sample string 32",
  "type": "sample string 33",
  "validationMessage": "sample string 34",
  "validationPattern": "sample string 35",
  "lastModifiedByUserId": "sample string 36",
  "lastModifiedByDisplayName": "sample string 37",
  "lastModified": "sample string 38",
  "createdByUserId": "sample string 39",
  "createdByDisplayName": "sample string 40",
  "editable": "sample string 41",
  "mergeField": {
    "configurationType": "sample string 1",
    "path": "sample string 2",
    "writeBack": "sample string 3",
    "allowSenderToEdit": "sample string 4",
    "row": "sample string 5"
  },
  "stampType": "sample string 42",
  "selected": "sample string 43"
}'
https://domain.com/v2.1/accounts/{{accountId}}/tab_definitions

Postman Collection Item JSON

{
  "name": "Creates a custom tab.",
  "request": {
    "method": "POST",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      },
      {
        "key": "Authorization",
        "value": "Bearer {{accessToken}}"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n  \"font\": \"sample string 1\",\n  \"bold\": \"sample string 2\",\n  \"italic\": \"sample string 3\",\n  \"underline\": \"sample string 4\",\n  \"fontColor\": \"sample string 5\",\n  \"fontSize\": \"sample string 6\",\n  \"anchor\": \"sample string 7\",\n  \"anchorXOffset\": \"sample string 8\",\n  \"anchorYOffset\": \"sample string 9\",\n  \"anchorUnits\": \"sample string 10\",\n  \"anchorIgnoreIfNotPresent\": \"sample string 11\",\n  \"anchorMatchWholeWord\": \"sample string 12\",\n  \"anchorCaseSensitive\": \"sample string 13\",\n  \"anchorHorizontalAlignment\": \"sample string 14\",\n  \"paymentItemCode\": \"sample string 15\",\n  \"paymentItemDescription\": \"sample string 16\",\n  \"paymentItemName\": \"sample string 17\",\n  \"height\": \"sample string 18\",\n  \"width\": \"sample string 19\",\n  \"customTabId\": \"sample string 20\",\n  \"initialValue\": \"sample string 21\",\n  \"includedInEmail\": \"sample string 22\",\n  \"disableAutoSize\": \"sample string 23\",\n  \"concealValueOnDocument\": \"sample string 24\",\n  \"locked\": \"sample string 25\",\n  \"required\": \"sample string 26\",\n  \"shared\": \"sample string 27\",\n  \"collaborative\": \"sample string 28\",\n  \"items\": [\n    \"sample string 1\"\n  ],\n  \"tabLabel\": \"sample string 29\",\n  \"maximumLength\": \"sample string 30\",\n  \"scaleValue\": \"sample string 31\",\n  \"name\": \"sample string 32\",\n  \"type\": \"sample string 33\",\n  \"validationMessage\": \"sample string 34\",\n  \"validationPattern\": \"sample string 35\",\n  \"lastModifiedByUserId\": \"sample string 36\",\n  \"lastModifiedByDisplayName\": \"sample string 37\",\n  \"lastModified\": \"sample string 38\",\n  \"createdByUserId\": \"sample string 39\",\n  \"createdByDisplayName\": \"sample string 40\",\n  \"editable\": \"sample string 41\",\n  \"mergeField\": {\n    \"configurationType\": \"sample string 1\",\n    \"path\": \"sample string 2\",\n    \"writeBack\": \"sample string 3\",\n    \"allowSenderToEdit\": \"sample string 4\",\n    \"row\": \"sample string 5\"\n  },\n  \"stampType\": \"sample string 42\",\n  \"selected\": \"sample string 43\"\n}"
    },
    "url": {
      "raw": "{{baseUrl}}/v2.1/accounts/{{accountId}}/tab_definitions",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "v2.1",
        "accounts",
        "{{accountId}}",
        "tab_definitions"
      ],
      "variable": [
        {
          "key": "accountId",
          "value": "{{accountId}}",
          "type": "string"
        }
      ]
    },
    "description": "Creates a tab with pre-defined properties, such as a text tab with a certain font type and validation pattern. Users can access the custom tabs when sending documents through the DocuSign web application.\n\nCustom tabs can be created for approve, checkbox, company, date, date signed, decline, email, email address, envelope ID, first name, formula, full name, initial here, last name, list, note, number, radio, sign here, signer attachment, SSN, text, title, and zip tabs."
  },
  "response": [
  ]
}