Chilkat Online Tools

SQL Server / DocuSign eSignature REST API / Modifies tab settings for specified account

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.

    -- {
    --   "textTabsEnabled": "sample string 1",
    --   "textTabsMetadata": {
    --     "rights": "sample string 1",
    --     "uiHint": "sample string 2",
    --     "uiType": "sample string 3",
    --     "uiOrder": "sample string 4",
    --     "is21CFRPart11": "sample string 5",
    --     "options": [
    --       "sample string 1"
    --     ]
    --   },
    --   "radioTabsEnabled": "sample string 2",
    --   "radioTabsMetadata": {},
    --   "checkboxTabsEnabled": "sample string 3",
    --   "checkboxTabsMetadata": {},
    --   "listTabsEnabled": "sample string 4",
    --   "listTabsMetadata": {},
    --   "approveDeclineTabsEnabled": "sample string 5",
    --   "approveDeclineTabsMetadata": {},
    --   "noteTabsEnabled": "sample string 6",
    --   "noteTabsMetadata": {},
    --   "dataFieldRegexEnabled": "sample string 7",
    --   "dataFieldRegexMetadata": {},
    --   "dataFieldSizeEnabled": "sample string 8",
    --   "dataFieldSizeMetadata": {},
    --   "tabLocationEnabled": "sample string 9",
    --   "tabLocationMetadata": {},
    --   "tabScaleEnabled": "sample string 10",
    --   "tabScaleMetadata": {},
    --   "tabLockingEnabled": "sample string 11",
    --   "tabLockingMetadata": {},
    --   "savingCustomTabsEnabled": "sample string 12",
    --   "savingCustomTabsMetadata": {},
    --   "tabTextFormattingEnabled": "sample string 13",
    --   "tabTextFormattingMetadata": {},
    --   "sharedCustomTabsEnabled": "sample string 14",
    --   "sharedCustomTabsMetadata": {},
    --   "senderToChangeTabAssignmentsEnabled": "sample string 15",
    --   "senderToChangeTabAssignmentsMetadata": {},
    --   "tabDataLabelEnabled": "sample string 16",
    --   "tabDataLabelMetadata": {},
    --   "firstLastEmailTabsEnabled": "sample string 17",
    --   "firstLastEmailTabsMetadata": {},
    --   "calculatedFieldsEnabled": "sample string 18",
    --   "calculatedFieldsMetadata": {},
    --   "allowTabOrder": "sample string 19",
    --   "allowTabOrderMetadata": {}
    -- }

    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, 'textTabsEnabled', 'sample string 1'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'textTabsMetadata.rights', 'sample string 1'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'textTabsMetadata.uiHint', 'sample string 2'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'textTabsMetadata.uiType', 'sample string 3'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'textTabsMetadata.uiOrder', 'sample string 4'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'textTabsMetadata.is21CFRPart11', 'sample string 5'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'textTabsMetadata.options[0]', 'sample string 1'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'radioTabsEnabled', 'sample string 2'
    EXEC sp_OAMethod @json, 'UpdateNewObject', @success OUT, 'radioTabsMetadata'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'checkboxTabsEnabled', 'sample string 3'
    EXEC sp_OAMethod @json, 'UpdateNewObject', @success OUT, 'checkboxTabsMetadata'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'listTabsEnabled', 'sample string 4'
    EXEC sp_OAMethod @json, 'UpdateNewObject', @success OUT, 'listTabsMetadata'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'approveDeclineTabsEnabled', 'sample string 5'
    EXEC sp_OAMethod @json, 'UpdateNewObject', @success OUT, 'approveDeclineTabsMetadata'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'noteTabsEnabled', 'sample string 6'
    EXEC sp_OAMethod @json, 'UpdateNewObject', @success OUT, 'noteTabsMetadata'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'dataFieldRegexEnabled', 'sample string 7'
    EXEC sp_OAMethod @json, 'UpdateNewObject', @success OUT, 'dataFieldRegexMetadata'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'dataFieldSizeEnabled', 'sample string 8'
    EXEC sp_OAMethod @json, 'UpdateNewObject', @success OUT, 'dataFieldSizeMetadata'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'tabLocationEnabled', 'sample string 9'
    EXEC sp_OAMethod @json, 'UpdateNewObject', @success OUT, 'tabLocationMetadata'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'tabScaleEnabled', 'sample string 10'
    EXEC sp_OAMethod @json, 'UpdateNewObject', @success OUT, 'tabScaleMetadata'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'tabLockingEnabled', 'sample string 11'
    EXEC sp_OAMethod @json, 'UpdateNewObject', @success OUT, 'tabLockingMetadata'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'savingCustomTabsEnabled', 'sample string 12'
    EXEC sp_OAMethod @json, 'UpdateNewObject', @success OUT, 'savingCustomTabsMetadata'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'tabTextFormattingEnabled', 'sample string 13'
    EXEC sp_OAMethod @json, 'UpdateNewObject', @success OUT, 'tabTextFormattingMetadata'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'sharedCustomTabsEnabled', 'sample string 14'
    EXEC sp_OAMethod @json, 'UpdateNewObject', @success OUT, 'sharedCustomTabsMetadata'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'senderToChangeTabAssignmentsEnabled', 'sample string 15'
    EXEC sp_OAMethod @json, 'UpdateNewObject', @success OUT, 'senderToChangeTabAssignmentsMetadata'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'tabDataLabelEnabled', 'sample string 16'
    EXEC sp_OAMethod @json, 'UpdateNewObject', @success OUT, 'tabDataLabelMetadata'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'firstLastEmailTabsEnabled', 'sample string 17'
    EXEC sp_OAMethod @json, 'UpdateNewObject', @success OUT, 'firstLastEmailTabsMetadata'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'calculatedFieldsEnabled', 'sample string 18'
    EXEC sp_OAMethod @json, 'UpdateNewObject', @success OUT, 'calculatedFieldsMetadata'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'allowTabOrder', 'sample string 19'
    EXEC sp_OAMethod @json, 'UpdateNewObject', @success OUT, 'allowTabOrderMetadata'

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

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

    EXEC sp_OAMethod @json, 'EmitSb', @success OUT, @sbRequestBody

    DECLARE @resp int
    EXEC sp_OAMethod @http, 'PTextSb', @resp OUT, 'PUT', 'https://domain.com/v2.1/accounts/{{accountId}}/settings/tabs', @sbRequestBody, 'utf-8', 'application/json', 0, 0
    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
        EXEC @hr = sp_OADestroy @sbRequestBody
        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
    EXEC @hr = sp_OADestroy @sbRequestBody


END
GO

Curl Command

curl -X PUT
	-H "Accept: application/json"
	-H "Authorization: Bearer {{accessToken}}"
	-d '{
  "textTabsEnabled": "sample string 1",
  "textTabsMetadata": {
    "rights": "sample string 1",
    "uiHint": "sample string 2",
    "uiType": "sample string 3",
    "uiOrder": "sample string 4",
    "is21CFRPart11": "sample string 5",
    "options": [
      "sample string 1"
    ]
  },
  "radioTabsEnabled": "sample string 2",
  "radioTabsMetadata": {},
  "checkboxTabsEnabled": "sample string 3",
  "checkboxTabsMetadata": {},
  "listTabsEnabled": "sample string 4",
  "listTabsMetadata": {},
  "approveDeclineTabsEnabled": "sample string 5",
  "approveDeclineTabsMetadata": {},
  "noteTabsEnabled": "sample string 6",
  "noteTabsMetadata": {},
  "dataFieldRegexEnabled": "sample string 7",
  "dataFieldRegexMetadata": {},
  "dataFieldSizeEnabled": "sample string 8",
  "dataFieldSizeMetadata": {},
  "tabLocationEnabled": "sample string 9",
  "tabLocationMetadata": {},
  "tabScaleEnabled": "sample string 10",
  "tabScaleMetadata": {},
  "tabLockingEnabled": "sample string 11",
  "tabLockingMetadata": {},
  "savingCustomTabsEnabled": "sample string 12",
  "savingCustomTabsMetadata": {},
  "tabTextFormattingEnabled": "sample string 13",
  "tabTextFormattingMetadata": {},
  "sharedCustomTabsEnabled": "sample string 14",
  "sharedCustomTabsMetadata": {},
  "senderToChangeTabAssignmentsEnabled": "sample string 15",
  "senderToChangeTabAssignmentsMetadata": {},
  "tabDataLabelEnabled": "sample string 16",
  "tabDataLabelMetadata": {},
  "firstLastEmailTabsEnabled": "sample string 17",
  "firstLastEmailTabsMetadata": {},
  "calculatedFieldsEnabled": "sample string 18",
  "calculatedFieldsMetadata": {},
  "allowTabOrder": "sample string 19",
  "allowTabOrderMetadata": {}
}'
https://domain.com/v2.1/accounts/{{accountId}}/settings/tabs

Postman Collection Item JSON

{
  "name": "Modifies tab settings for specified account",
  "request": {
    "method": "PUT",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      },
      {
        "key": "Authorization",
        "value": "Bearer {{accessToken}}"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n  \"textTabsEnabled\": \"sample string 1\",\n  \"textTabsMetadata\": {\n    \"rights\": \"sample string 1\",\n    \"uiHint\": \"sample string 2\",\n    \"uiType\": \"sample string 3\",\n    \"uiOrder\": \"sample string 4\",\n    \"is21CFRPart11\": \"sample string 5\",\n    \"options\": [\n      \"sample string 1\"\n    ]\n  },\n  \"radioTabsEnabled\": \"sample string 2\",\n  \"radioTabsMetadata\": {},\n  \"checkboxTabsEnabled\": \"sample string 3\",\n  \"checkboxTabsMetadata\": {},\n  \"listTabsEnabled\": \"sample string 4\",\n  \"listTabsMetadata\": {},\n  \"approveDeclineTabsEnabled\": \"sample string 5\",\n  \"approveDeclineTabsMetadata\": {},\n  \"noteTabsEnabled\": \"sample string 6\",\n  \"noteTabsMetadata\": {},\n  \"dataFieldRegexEnabled\": \"sample string 7\",\n  \"dataFieldRegexMetadata\": {},\n  \"dataFieldSizeEnabled\": \"sample string 8\",\n  \"dataFieldSizeMetadata\": {},\n  \"tabLocationEnabled\": \"sample string 9\",\n  \"tabLocationMetadata\": {},\n  \"tabScaleEnabled\": \"sample string 10\",\n  \"tabScaleMetadata\": {},\n  \"tabLockingEnabled\": \"sample string 11\",\n  \"tabLockingMetadata\": {},\n  \"savingCustomTabsEnabled\": \"sample string 12\",\n  \"savingCustomTabsMetadata\": {},\n  \"tabTextFormattingEnabled\": \"sample string 13\",\n  \"tabTextFormattingMetadata\": {},\n  \"sharedCustomTabsEnabled\": \"sample string 14\",\n  \"sharedCustomTabsMetadata\": {},\n  \"senderToChangeTabAssignmentsEnabled\": \"sample string 15\",\n  \"senderToChangeTabAssignmentsMetadata\": {},\n  \"tabDataLabelEnabled\": \"sample string 16\",\n  \"tabDataLabelMetadata\": {},\n  \"firstLastEmailTabsEnabled\": \"sample string 17\",\n  \"firstLastEmailTabsMetadata\": {},\n  \"calculatedFieldsEnabled\": \"sample string 18\",\n  \"calculatedFieldsMetadata\": {},\n  \"allowTabOrder\": \"sample string 19\",\n  \"allowTabOrderMetadata\": {}\n}"
    },
    "url": {
      "raw": "{{baseUrl}}/v2.1/accounts/{{accountId}}/settings/tabs",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "v2.1",
        "accounts",
        "{{accountId}}",
        "settings",
        "tabs"
      ],
      "variable": [
        {
          "key": "accountId",
          "value": "{{accountId}}",
          "type": "string"
        }
      ]
    }
  },
  "response": [
  ]
}