Chilkat Online Tools

SQL Server / Atlassian Confluence Cloud / Get current user

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

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

    EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'expand', '<string>'
    EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'expand', '<string>'

    -- Adds the "Authorization: Bearer <access_token>" header.
    EXEC sp_OASetProperty @http, 'AuthToken', '<access_token>'

    DECLARE @resp int
    EXEC sp_OAMethod @http, 'QuickRequestParams', @resp OUT, 'GET', 'https://your-domain.atlassian.net/wiki/rest/api/user/current', @queryParams
    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 @queryParams
        RETURN
      END

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

    EXEC sp_OAMethod @resp, 'GetBodySb', @success OUT, @sbResponseBody

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

    EXEC sp_OAMethod @jResp, 'LoadSb', @success OUT, @sbResponseBody
    EXEC sp_OASetProperty @jResp, 'EmitCompact', 0


    PRINT 'Response Body:'
    EXEC sp_OAMethod @jResp, 'Emit', @sTmp0 OUT
    PRINT @sTmp0

    DECLARE @respStatusCode int
    EXEC sp_OAGetProperty @resp, 'StatusCode', @respStatusCode OUT

    PRINT 'Response Status Code = ' + @respStatusCode
    IF @respStatusCode >= 400
      BEGIN

        PRINT 'Response Header:'
        EXEC sp_OAGetProperty @resp, 'Header', @sTmp0 OUT
        PRINT @sTmp0

        PRINT 'Failed.'
        EXEC @hr = sp_OADestroy @resp

        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @queryParams
        EXEC @hr = sp_OADestroy @sbResponseBody
        EXEC @hr = sp_OADestroy @jResp
        RETURN
      END
    EXEC @hr = sp_OADestroy @resp

    -- Sample JSON response:
    -- (Sample code for parsing the JSON response is shown below)

    -- {
    --   "type": "unknown",
    --   "accountId": "sit consectetur",
    --   "accountType": "atlassian",
    --   "email": "do",
    --   "publicName": "et nostrud mollit id",
    --   "profilePicture": {
    --     "path": "eiusmod Excepteur",
    --     "width": 61811707,
    --     "height": -27758421,
    --     "isDefault": true
    --   },
    --   "displayName": "eiusmod pariatur aliqua cupidatat",
    --   "_expandable": {
    --     "operations": "officia nu",
    --     "details": "exercitation ipsum elit tempor laborum",
    --     "personalSpace": "exercitation re"
    --   },
    --   "_links": {},
    --   "username": "sed velit Ut",
    --   "userKey": "labore anim",
    --   "operations": [
    --     {
    --       "operation": "use",
    --       "targetType": "application"
    --     },
    --     {
    --       "operation": "restore",
    --       "targetType": "space"
    --     }
    --   ],
    --   "details": {
    --     "business": {
    --       "value": "<Error: Too many levels of nesting to fake this schema>"
    --     },
    --     "personal": {
    --       "value": "<Error: Too many levels of nesting to fake this schema>"
    --     }
    --   },
    --   "personalSpace": {
    --     "id": -69293677,
    --     "key": "minim",
    --     "name": "adipisicing minim nulla nisi consequat",
    --     "type": "reprehenderit",
    --     "status": "amet officia pariatur sed",
    --     "_expandable": {
    --       "settings": "deserunt dolore velit laborum",
    --       "metadata": "ullamco quis non sunt",
    --       "operations": "qui aliquip",
    --       "lookAndFeel": "eiusmod cillum ex",
    --       "permissions": "in ullamco",
    --       "icon": "veniam quis",
    --       "description": "officia adip",
    --       "theme": "ea nisi",
    --       "history": "aliquip est irure",
    --       "homepage": "aliqua est deserunt"
    --     },
    --     "_links": {},
    --     "icon": {
    --       "path": "adipisicing sed officia",
    --       "width": 33631448,
    --       "height": -10767970,
    --       "isDefault": true
    --     },
    --     "description": {
    --       "plain": {
    --         "value": "cupidatat nulla",
    --         "representation": "view",
    --         "embeddedContent": [
    --           {
    --             "value": "<Error: Too many levels of nesting to fake this schema>"
    --           },
    --           {
    --             "value": "<Error: Too many levels of nesting to fake this schema>"
    --           }
    --         ]
    --       },
    --       "view": {
    --         "value": "magna aliquip ea",
    --         "representation": "plain",
    --         "embeddedContent": [
    --           {
    --             "value": "<Error: Too many levels of nesting to fake this schema>"
    --           },
    --           {
    --             "value": "<Error: Too many levels of nesting to fake this schema>"
    --           }
    --         ]
    --       }
    --     },
    --     "homepage": {
    --       "value": "<Circular reference to #/components/schemas/Content detected>"
    --     },
    --     "metadata": {
    --       "labels": {
    --         "results": [
    --           {
    --             "value": "<Error: Too many levels of nesting to fake this schema>"
    --           },
    --           {
    --             "value": "<Error: Too many levels of nesting to fake this schema>"
    --           }
    --         ],
    --         "start": 58105433,
    --         "limit": 10735114,
    --         "size": -29792214,
    --         "_links": {}
    --       }
    --     },
    --     "operations": [
    --       {
    --         "operation": "delete",
    --         "targetType": "blogpost"
    --       },
    --       {
    --         "operation": "restore",
    --         "targetType": "blogpost"
    --       }
    --     ],
    --     "permissions": [
    --       {
    --         "subjects": {
    --           "_expandable": {
    --             "value": "<Error: Too many levels of nesting to fake this schema>"
    --           },
    --           "user": {
    --             "value": "<Error: Too many levels of nesting to fake this schema>"
    --           },
    --           "group": {
    --             "value": "<Error: Too many levels of nesting to fake this schema>"
    --           }
    --         },
    --         "operation": {
    --           "operation": "create",
    --           "targetType": "page"
    --         },
    --         "anonymousAccess": false,
    --         "unlicensedAccess": false
    --       },
    --       {
    --         "subjects": {
    --           "_expandable": {
    --             "value": "<Error: Too many levels of nesting to fake this schema>"
    --           },
    --           "user": {
    --             "value": "<Error: Too many levels of nesting to fake this schema>"
    --           },
    --           "group": {
    --             "value": "<Error: Too many levels of nesting to fake this schema>"
    --           }
    --         },
    --         "operation": {
    --           "operation": "restore",
    --           "targetType": "blogpost"
    --         },
    --         "anonymousAccess": false,
    --         "unlicensedAccess": false
    --       }
    --     ],
    --     "settings": {
    --       "routeOverrideEnabled": false,
    --       "_links": {}
    --     },
    --     "theme": {},
    --     "lookAndFeel": {
    --       "headings": {
    --         "color": "<string>"
    --       },
    --       "links": {
    --         "color": "<string>"
    --       },
    --       "menus": {
    --         "hoverOrFocus": {
    --           "value": "<Error: Too many levels of nesting to fake this schema>"
    --         },
    --         "color": {
    --           "value": "<Error: Too many levels of nesting to fake this schema>"
    --         }
    --       },
    --       "header": {
    --         "backgroundColor": {
    --           "value": "<Error: Too many levels of nesting to fake this schema>"
    --         },
    --         "button": {
    --           "value": "<Error: Too many levels of nesting to fake this schema>"
    --         },
    --         "primaryNavigation": {
    --           "value": "<Error: Too many levels of nesting to fake this schema>"
    --         },
    --         "secondaryNavigation": {
    --           "value": "<Error: Too many levels of nesting to fake this schema>"
    --         },
    --         "search": {
    --           "value": "<Error: Too many levels of nesting to fake this schema>"
    --         }
    --       },
    --       "content": {
    --         "screen": {
    --           "value": "<Error: Too many levels of nesting to fake this schema>"
    --         },
    --         "container": {
    --           "value": "<Error: Too many levels of nesting to fake this schema>"
    --         },
    --         "header": {
    --           "value": "<Error: Too many levels of nesting to fake this schema>"
    --         },
    --         "body": {
    --           "value": "<Error: Too many levels of nesting to fake this schema>"
    --         }
    --       },
    --       "bordersAndDividers": {
    --         "color": "<string>"
    --       }
    --     },
    --     "history": {
    --       "createdDate": "2014-12-12T23:08:45.947Z"
    --     }
    --   }
    -- }

    -- Sample code for parsing the JSON response...
    -- Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

    DECLARE @operation nvarchar(4000)

    DECLARE @targetType nvarchar(4000)

    DECLARE @value nvarchar(4000)

    DECLARE @v_expandableValue nvarchar(4000)

    DECLARE @UserValue nvarchar(4000)

    DECLARE @GroupValue nvarchar(4000)

    DECLARE @Operation nvarchar(4000)

    DECLARE @TargetType nvarchar(4000)

    DECLARE @anonymousAccess int

    DECLARE @unlicensedAccess int

    DECLARE @v_type nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @v_type OUT, 'type'
    DECLARE @accountId nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @accountId OUT, 'accountId'
    DECLARE @accountType nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @accountType OUT, 'accountType'
    DECLARE @email nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @email OUT, 'email'
    DECLARE @publicName nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @publicName OUT, 'publicName'
    DECLARE @Path nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Path OUT, 'profilePicture.path'
    DECLARE @Width int
    EXEC sp_OAMethod @jResp, 'IntOf', @Width OUT, 'profilePicture.width'
    DECLARE @Height int
    EXEC sp_OAMethod @jResp, 'IntOf', @Height OUT, 'profilePicture.height'
    DECLARE @IsDefault int
    EXEC sp_OAMethod @jResp, 'BoolOf', @IsDefault OUT, 'profilePicture.isDefault'
    DECLARE @displayName nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @displayName OUT, 'displayName'
    DECLARE @Operations nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Operations OUT, '_expandable.operations'
    DECLARE @Details nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Details OUT, '_expandable.details'
    DECLARE @PersonalSpace nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @PersonalSpace OUT, '_expandable.personalSpace'
    DECLARE @username nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @username OUT, 'username'
    DECLARE @userKey nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @userKey OUT, 'userKey'
    DECLARE @Value nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Value OUT, 'details.business.value'
    DECLARE @PersonalValue nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @PersonalValue OUT, 'details.personal.value'
    DECLARE @Id int
    EXEC sp_OAMethod @jResp, 'IntOf', @Id OUT, 'personalSpace.id'
    DECLARE @Key nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Key OUT, 'personalSpace.key'
    DECLARE @Name nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Name OUT, 'personalSpace.name'
    DECLARE @v_Type nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @v_Type OUT, 'personalSpace.type'
    DECLARE @Status nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Status OUT, 'personalSpace.status'
    DECLARE @Settings nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Settings OUT, 'personalSpace._expandable.settings'
    DECLARE @Metadata nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Metadata OUT, 'personalSpace._expandable.metadata'
    DECLARE @v_expandableOperations nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @v_expandableOperations OUT, 'personalSpace._expandable.operations'
    DECLARE @LookAndFeel nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @LookAndFeel OUT, 'personalSpace._expandable.lookAndFeel'
    DECLARE @Permissions nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Permissions OUT, 'personalSpace._expandable.permissions'
    DECLARE @Icon nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Icon OUT, 'personalSpace._expandable.icon'
    DECLARE @Description nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Description OUT, 'personalSpace._expandable.description'
    DECLARE @Theme nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Theme OUT, 'personalSpace._expandable.theme'
    DECLARE @History nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @History OUT, 'personalSpace._expandable.history'
    DECLARE @Homepage nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Homepage OUT, 'personalSpace._expandable.homepage'
    DECLARE @IconPath nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @IconPath OUT, 'personalSpace.icon.path'
    DECLARE @IconWidth int
    EXEC sp_OAMethod @jResp, 'IntOf', @IconWidth OUT, 'personalSpace.icon.width'
    DECLARE @IconHeight int
    EXEC sp_OAMethod @jResp, 'IntOf', @IconHeight OUT, 'personalSpace.icon.height'
    DECLARE @IconIsDefault int
    EXEC sp_OAMethod @jResp, 'BoolOf', @IconIsDefault OUT, 'personalSpace.icon.isDefault'
    DECLARE @PlainValue nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @PlainValue OUT, 'personalSpace.description.plain.value'
    DECLARE @Representation nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Representation OUT, 'personalSpace.description.plain.representation'
    DECLARE @ViewValue nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @ViewValue OUT, 'personalSpace.description.view.value'
    DECLARE @ViewRepresentation nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @ViewRepresentation OUT, 'personalSpace.description.view.representation'
    DECLARE @HomepageValue nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @HomepageValue OUT, 'personalSpace.homepage.value'
    DECLARE @Start int
    EXEC sp_OAMethod @jResp, 'IntOf', @Start OUT, 'personalSpace.metadata.labels.start'
    DECLARE @Limit int
    EXEC sp_OAMethod @jResp, 'IntOf', @Limit OUT, 'personalSpace.metadata.labels.limit'
    DECLARE @Size int
    EXEC sp_OAMethod @jResp, 'IntOf', @Size OUT, 'personalSpace.metadata.labels.size'
    DECLARE @RouteOverrideEnabled int
    EXEC sp_OAMethod @jResp, 'BoolOf', @RouteOverrideEnabled OUT, 'personalSpace.settings.routeOverrideEnabled'
    DECLARE @Color nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Color OUT, 'personalSpace.lookAndFeel.headings.color'
    DECLARE @LinksColor nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @LinksColor OUT, 'personalSpace.lookAndFeel.links.color'
    DECLARE @HoverOrFocusValue nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @HoverOrFocusValue OUT, 'personalSpace.lookAndFeel.menus.hoverOrFocus.value'
    DECLARE @ColorValue nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @ColorValue OUT, 'personalSpace.lookAndFeel.menus.color.value'
    DECLARE @BackgroundColorValue nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @BackgroundColorValue OUT, 'personalSpace.lookAndFeel.header.backgroundColor.value'
    DECLARE @ButtonValue nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @ButtonValue OUT, 'personalSpace.lookAndFeel.header.button.value'
    DECLARE @PrimaryNavigationValue nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @PrimaryNavigationValue OUT, 'personalSpace.lookAndFeel.header.primaryNavigation.value'
    DECLARE @SecondaryNavigationValue nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @SecondaryNavigationValue OUT, 'personalSpace.lookAndFeel.header.secondaryNavigation.value'
    DECLARE @SearchValue nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @SearchValue OUT, 'personalSpace.lookAndFeel.header.search.value'
    DECLARE @ScreenValue nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @ScreenValue OUT, 'personalSpace.lookAndFeel.content.screen.value'
    DECLARE @ContainerValue nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @ContainerValue OUT, 'personalSpace.lookAndFeel.content.container.value'
    DECLARE @HeaderValue nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @HeaderValue OUT, 'personalSpace.lookAndFeel.content.header.value'
    DECLARE @BodyValue nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @BodyValue OUT, 'personalSpace.lookAndFeel.content.body.value'
    DECLARE @BordersAndDividersColor nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @BordersAndDividersColor OUT, 'personalSpace.lookAndFeel.bordersAndDividers.color'
    DECLARE @CreatedDate nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @CreatedDate OUT, 'personalSpace.history.createdDate'
    DECLARE @i int
    SELECT @i = 0
    DECLARE @count_i int
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'operations'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @operation OUT, 'operations[i].operation'
        EXEC sp_OAMethod @jResp, 'StringOf', @targetType OUT, 'operations[i].targetType'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'personalSpace.description.plain.embeddedContent'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @value OUT, 'personalSpace.description.plain.embeddedContent[i].value'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'personalSpace.description.view.embeddedContent'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @value OUT, 'personalSpace.description.view.embeddedContent[i].value'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'personalSpace.metadata.labels.results'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @value OUT, 'personalSpace.metadata.labels.results[i].value'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'personalSpace.operations'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @operation OUT, 'personalSpace.operations[i].operation'
        EXEC sp_OAMethod @jResp, 'StringOf', @targetType OUT, 'personalSpace.operations[i].targetType'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'personalSpace.permissions'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @v_expandableValue OUT, 'personalSpace.permissions[i].subjects._expandable.value'
        EXEC sp_OAMethod @jResp, 'StringOf', @UserValue OUT, 'personalSpace.permissions[i].subjects.user.value'
        EXEC sp_OAMethod @jResp, 'StringOf', @GroupValue OUT, 'personalSpace.permissions[i].subjects.group.value'
        EXEC sp_OAMethod @jResp, 'StringOf', @Operation OUT, 'personalSpace.permissions[i].operation.operation'
        EXEC sp_OAMethod @jResp, 'StringOf', @TargetType OUT, 'personalSpace.permissions[i].operation.targetType'
        EXEC sp_OAMethod @jResp, 'BoolOf', @anonymousAccess OUT, 'personalSpace.permissions[i].anonymousAccess'
        EXEC sp_OAMethod @jResp, 'BoolOf', @unlicensedAccess OUT, 'personalSpace.permissions[i].unlicensedAccess'
        SELECT @i = @i + 1
      END

    EXEC @hr = sp_OADestroy @http
    EXEC @hr = sp_OADestroy @queryParams
    EXEC @hr = sp_OADestroy @sbResponseBody
    EXEC @hr = sp_OADestroy @jResp


END
GO

Curl Command

curl -G -d "expand=%3Cstring%3E"
	-d "expand=%3Cstring%3E"
	-H "Authorization: Bearer <access_token>"
https://your-domain.atlassian.net/wiki/rest/api/user/current

Postman Collection Item JSON

{
  "name": "Get current user",
  "request": {
    "auth": {
      "type": "oauth2"
    },
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/api/user/current?expand=<string>&expand=<string>",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "user",
        "current"
      ],
      "query": [
        {
          "key": "expand",
          "value": "<string>",
          "description": "A multi-value parameter indicating which properties of the user to\nexpand.\n\n  - `operations` returns the operations that the user is allowed to do.\n  - `details.personal` returns the 'Personal' details in the user's profile, like the 'Email' and 'Phone'.\n  Note that these fields have been deprecated due to privacy changes. See the\n  [migration guide](https://developer.atlassian.com/cloud/confluence/deprecation-notice-user-privacy-api-migration-guide/)\n  for details.\n  - `details.business` returns the 'Company' details in the user's profile, like the 'Position' and 'Department'.\n  Note that these fields have been deprecated due to privacy changes. See the\n  [migration guide](https://developer.atlassian.com/cloud/confluence/deprecation-notice-user-privacy-api-migration-guide/)\n  for details.\n  - personalSpace returns the user's personal space, if it exists."
        },
        {
          "key": "expand",
          "value": "<string>",
          "description": "A multi-value parameter indicating which properties of the user to\nexpand.\n\n  - `operations` returns the operations that the user is allowed to do.\n  - `details.personal` returns the 'Personal' details in the user's profile, like the 'Email' and 'Phone'.\n  Note that these fields have been deprecated due to privacy changes. See the\n  [migration guide](https://developer.atlassian.com/cloud/confluence/deprecation-notice-user-privacy-api-migration-guide/)\n  for details.\n  - `details.business` returns the 'Company' details in the user's profile, like the 'Position' and 'Department'.\n  Note that these fields have been deprecated due to privacy changes. See the\n  [migration guide](https://developer.atlassian.com/cloud/confluence/deprecation-notice-user-privacy-api-migration-guide/)\n  for details.\n  - personalSpace returns the user's personal space, if it exists."
        }
      ]
    },
    "description": "Returns the currently logged-in user. This includes information about\nthe user, like the display name, userKey, account ID, profile picture,\nand more.\n\n**[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:\nPermission to access the Confluence site ('Can use' global permission)."
  },
  "response": [
    {
      "name": "Returned if the current user is returned.",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": {
              "content": "Added as a part of security scheme: oauth2",
              "type": "text/plain"
            },
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/user/current?expand=<string>&expand=<string>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "user",
            "current"
          ],
          "query": [
            {
              "key": "expand",
              "value": "<string>"
            },
            {
              "key": "expand",
              "value": "<string>"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"type\": \"unknown\",\n \"accountId\": \"sit consectetur\",\n \"accountType\": \"atlassian\",\n \"email\": \"do\",\n \"publicName\": \"et nostrud mollit id\",\n \"profilePicture\": {\n  \"path\": \"eiusmod Excepteur\",\n  \"width\": 61811707,\n  \"height\": -27758421,\n  \"isDefault\": true\n },\n \"displayName\": \"eiusmod pariatur aliqua cupidatat\",\n \"_expandable\": {\n  \"operations\": \"officia nu\",\n  \"details\": \"exercitation ipsum elit tempor laborum\",\n  \"personalSpace\": \"exercitation re\"\n },\n \"_links\": {},\n \"username\": \"sed velit Ut\",\n \"userKey\": \"labore anim\",\n \"operations\": [\n  {\n   \"operation\": \"use\",\n   \"targetType\": \"application\"\n  },\n  {\n   \"operation\": \"restore\",\n   \"targetType\": \"space\"\n  }\n ],\n \"details\": {\n  \"business\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  },\n  \"personal\": {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  }\n },\n \"personalSpace\": {\n  \"id\": -69293677,\n  \"key\": \"minim\",\n  \"name\": \"adipisicing minim nulla nisi consequat\",\n  \"type\": \"reprehenderit\",\n  \"status\": \"amet officia pariatur sed\",\n  \"_expandable\": {\n   \"settings\": \"deserunt dolore velit laborum\",\n   \"metadata\": \"ullamco quis non sunt\",\n   \"operations\": \"qui aliquip\",\n   \"lookAndFeel\": \"eiusmod cillum ex\",\n   \"permissions\": \"in ullamco\",\n   \"icon\": \"veniam quis\",\n   \"description\": \"officia adip\",\n   \"theme\": \"ea nisi\",\n   \"history\": \"aliquip est irure\",\n   \"homepage\": \"aliqua est deserunt\"\n  },\n  \"_links\": {},\n  \"icon\": {\n   \"path\": \"adipisicing sed officia\",\n   \"width\": 33631448,\n   \"height\": -10767970,\n   \"isDefault\": true\n  },\n  \"description\": {\n   \"plain\": {\n    \"value\": \"cupidatat nulla\",\n    \"representation\": \"view\",\n    \"embeddedContent\": [\n     {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     },\n     {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     }\n    ]\n   },\n   \"view\": {\n    \"value\": \"magna aliquip ea\",\n    \"representation\": \"plain\",\n    \"embeddedContent\": [\n     {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     },\n     {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     }\n    ]\n   }\n  },\n  \"homepage\": {\n   \"value\": \"<Circular reference to #/components/schemas/Content detected>\"\n  },\n  \"metadata\": {\n   \"labels\": {\n    \"results\": [\n     {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     },\n     {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     }\n    ],\n    \"start\": 58105433,\n    \"limit\": 10735114,\n    \"size\": -29792214,\n    \"_links\": {}\n   }\n  },\n  \"operations\": [\n   {\n    \"operation\": \"delete\",\n    \"targetType\": \"blogpost\"\n   },\n   {\n    \"operation\": \"restore\",\n    \"targetType\": \"blogpost\"\n   }\n  ],\n  \"permissions\": [\n   {\n    \"subjects\": {\n     \"_expandable\": {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     },\n     \"user\": {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     },\n     \"group\": {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     }\n    },\n    \"operation\": {\n     \"operation\": \"create\",\n     \"targetType\": \"page\"\n    },\n    \"anonymousAccess\": false,\n    \"unlicensedAccess\": false\n   },\n   {\n    \"subjects\": {\n     \"_expandable\": {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     },\n     \"user\": {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     },\n     \"group\": {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     }\n    },\n    \"operation\": {\n     \"operation\": \"restore\",\n     \"targetType\": \"blogpost\"\n    },\n    \"anonymousAccess\": false,\n    \"unlicensedAccess\": false\n   }\n  ],\n  \"settings\": {\n   \"routeOverrideEnabled\": false,\n   \"_links\": {}\n  },\n  \"theme\": {},\n  \"lookAndFeel\": {\n   \"headings\": {\n    \"color\": \"<string>\"\n   },\n   \"links\": {\n    \"color\": \"<string>\"\n   },\n   \"menus\": {\n    \"hoverOrFocus\": {\n     \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n    },\n    \"color\": {\n     \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n    }\n   },\n   \"header\": {\n    \"backgroundColor\": {\n     \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n    },\n    \"button\": {\n     \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n    },\n    \"primaryNavigation\": {\n     \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n    },\n    \"secondaryNavigation\": {\n     \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n    },\n    \"search\": {\n     \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n    }\n   },\n   \"content\": {\n    \"screen\": {\n     \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n    },\n    \"container\": {\n     \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n    },\n    \"header\": {\n     \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n    },\n    \"body\": {\n     \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n    }\n   },\n   \"bordersAndDividers\": {\n    \"color\": \"<string>\"\n   }\n  },\n  \"history\": {\n   \"createdDate\": \"2014-12-12T23:08:45.947Z\"\n  }\n }\n}"
    },
    {
      "name": "Returned if the calling user does not have permission to use\nConfluence.",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": {
              "content": "Added as a part of security scheme: oauth2",
              "type": "text/plain"
            },
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/user/current?expand=<string>&expand=<string>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "user",
            "current"
          ],
          "query": [
            {
              "key": "expand",
              "value": "<string>"
            },
            {
              "key": "expand",
              "value": "<string>"
            }
          ]
        }
      },
      "status": "Forbidden",
      "code": 403,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}