Sample code for 30+ languages & platforms
SQL Server

MYOB: Fetch the Category Register

See more MYOB Examples

Return transactions grouped with categories A register of all transactions grouped with categories

Chilkat SQL Server Downloads

SQL Server
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    -- Important: Do not use nvarchar(max).  See the warning about using nvarchar(max).
    DECLARE @sTmp0 nvarchar(4000)
    DECLARE @success int
    SELECT @success = 0

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

    DECLARE @http int
    EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    -- Implements the following CURL command:

    -- curl --request GET "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/CategoryRegister" \
    --   --header "Authorization: Bearer ACCESS_TOKEN" \
    --   --header "x-myobapi-key: {{myob_api_key}}" \
    --   --header "x-myobapi-version: v2" \
    --   --header "Accept-Encoding: gzip,deflate"

    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Authorization', 'Bearer ACCESS_TOKEN'
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'x-myobapi-key', '{{myob_api_key}}'
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Accept-Encoding', 'gzip,deflate'
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'x-myobapi-version', 'v2'

    DECLARE @sbResponseBody int
    EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbResponseBody OUT

    EXEC sp_OAMethod @http, 'QuickGetSb', @success OUT, 'https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/CategoryRegister', @sbResponseBody
    IF @success = 0
      BEGIN
        EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @sbResponseBody
        RETURN
      END

    DECLARE @jResp int
    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 @http, 'LastStatus', @respStatusCode OUT

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

        PRINT 'Response Header:'
        EXEC sp_OAGetProperty @http, 'LastHeader', @sTmp0 OUT
        PRINT @sTmp0

        PRINT 'Failed.'
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @sbResponseBody
        EXEC @hr = sp_OADestroy @jResp
        RETURN
      END

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

    -- {
    --   "Items": [
    --     {
    --       "Category": {
    --         "UID": "80b6a90d-e22a-47e3-a5e7-a2ee9126f153",
    --         "Name": "Craigs Category",
    --         "DisplayID": "Craigs",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Category/80b6a90d-e22a-47e3-a5e7-a2ee9126f153"
    --       },
    --       "Account": {
    --         "UID": "40ecbafd-51c0-40f3-9a28-d6a2b6d7422a",
    --         "Name": "Produce Income",
    --         "DisplayID": "4-1000",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Account/40ecbafd-51c0-40f3-9a28-d6a2b6d7422a"
    --       },
    --       "Year": 2015,
    --       "Month": 8,
    --       "Activity": -1050,
    --       "YearEndActivity": 0,
    --       "RowVersion": "1093536881590665216"
    --     },
    --     {
    --       "Category": {
    --         "UID": "20b483b2-9a89-4793-b8c3-2da1a6284e1f",
    --         "Name": "Postman sample",
    --         "DisplayID": "Postman001",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Category/20b483b2-9a89-4793-b8c3-2da1a6284e1f"
    --       },
    --       "Account": {
    --         "UID": "9541300c-edee-4e0b-82c0-9bc0d1917b2f",
    --         "Name": "Grain Income",
    --         "DisplayID": "4-2000",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Account/9541300c-edee-4e0b-82c0-9bc0d1917b2f"
    --       },
    --       "Year": 2015,
    --       "Month": 8,
    --       "Activity": -135.23,
    --       "YearEndActivity": 0,
    --       "RowVersion": "7736911480938823680"
    --     },
    --     {
    --       "Category": {
    --         "UID": "80b6a90d-e22a-47e3-a5e7-a2ee9126f153",
    --         "Name": "Craigs Category",
    --         "DisplayID": "Craigs",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Category/80b6a90d-e22a-47e3-a5e7-a2ee9126f153"
    --       },
    --       "Account": {
    --         "UID": "80b97a33-a650-4f6c-9e40-d466d92e4bcb",
    --         "Name": "GST Paid",
    --         "DisplayID": "2-1220",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Account/80b97a33-a650-4f6c-9e40-d466d92e4bcb"
    --       },
    --       "Year": 2015,
    --       "Month": 8,
    --       "Activity": -105,
    --       "YearEndActivity": 0,
    --       "RowVersion": "1165594475628593152"
    --     },
    --     {
    --       "Category": {
    --         "UID": "20b483b2-9a89-4793-b8c3-2da1a6284e1f",
    --         "Name": "Postman sample",
    --         "DisplayID": "Postman001",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Category/20b483b2-9a89-4793-b8c3-2da1a6284e1f"
    --       },
    --       "Account": {
    --         "UID": "80b97a33-a650-4f6c-9e40-d466d92e4bcb",
    --         "Name": "GST Paid",
    --         "DisplayID": "2-1220",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Account/80b97a33-a650-4f6c-9e40-d466d92e4bcb"
    --       },
    --       "Year": 2013,
    --       "Month": 9,
    --       "Activity": -62.5,
    --       "YearEndActivity": 0,
    --       "RowVersion": "4407341782405218304"
    --     },
    --     {
    --       "Category": {
    --         "UID": "20b483b2-9a89-4793-b8c3-2da1a6284e1f",
    --         "Name": "Postman sample",
    --         "DisplayID": "Postman001",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Category/20b483b2-9a89-4793-b8c3-2da1a6284e1f"
    --       },
    --       "Account": {
    --         "UID": "80b97a33-a650-4f6c-9e40-d466d92e4bcb",
    --         "Name": "GST Paid",
    --         "DisplayID": "2-1220",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Account/80b97a33-a650-4f6c-9e40-d466d92e4bcb"
    --       },
    --       "Year": 2015,
    --       "Month": 8,
    --       "Activity": -29.15,
    --       "YearEndActivity": 0,
    --       "RowVersion": "7881026669014679552"
    --     },
    --     {
    --       "Category": {
    --         "UID": "20b483b2-9a89-4793-b8c3-2da1a6284e1f",
    --         "Name": "Postman sample",
    --         "DisplayID": "Postman001",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Category/20b483b2-9a89-4793-b8c3-2da1a6284e1f"
    --       },
    --       "Account": {
    --         "UID": "9904f3e0-0ec1-4fee-be1c-477a8624d515",
    --         "Name": "Inventory",
    --         "DisplayID": "1-1320",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Account/9904f3e0-0ec1-4fee-be1c-477a8624d515"
    --       },
    --       "Year": 2015,
    --       "Month": 8,
    --       "Activity": -18.33,
    --       "YearEndActivity": 0,
    --       "RowVersion": "-1284645196637667328"
    --     },
    --     {
    --       "Category": {
    --         "UID": "20b483b2-9a89-4793-b8c3-2da1a6284e1f",
    --         "Name": "Postman sample",
    --         "DisplayID": "Postman001",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Category/20b483b2-9a89-4793-b8c3-2da1a6284e1f"
    --       },
    --       "Account": {
    --         "UID": "180a940e-714d-4ebb-88db-3f6044294cad",
    --         "Name": "Voluntary Withholdings Payable",
    --         "DisplayID": "2-1310",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Account/180a940e-714d-4ebb-88db-3f6044294cad"
    --       },
    --       "Year": 2013,
    --       "Month": 9,
    --       "Activity": 3,
    --       "YearEndActivity": 0,
    --       "RowVersion": "4479399376443146240"
    --     },
    --     {
    --       "Category": {
    --         "UID": "20b483b2-9a89-4793-b8c3-2da1a6284e1f",
    --         "Name": "Postman sample",
    --         "DisplayID": "Postman001",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Category/20b483b2-9a89-4793-b8c3-2da1a6284e1f"
    --       },
    --       "Account": {
    --         "UID": "44c2047b-5b16-43cf-82ee-d8a174ebec09",
    --         "Name": "Voluntary Withholding Credits",
    --         "DisplayID": "1-1340",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Account/44c2047b-5b16-43cf-82ee-d8a174ebec09"
    --       },
    --       "Year": 2013,
    --       "Month": 9,
    --       "Activity": 14,
    --       "YearEndActivity": 0,
    --       "RowVersion": "4335284188367290368"
    --     },
    --     {
    --       "Category": {
    --         "UID": "20b483b2-9a89-4793-b8c3-2da1a6284e1f",
    --         "Name": "Postman sample",
    --         "DisplayID": "Postman001",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Category/20b483b2-9a89-4793-b8c3-2da1a6284e1f"
    --       },
    --       "Account": {
    --         "UID": "b2ff345a-2de6-4160-b319-66d01334a5ad",
    --         "Name": "GST Collected",
    --         "DisplayID": "2-1210",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Account/b2ff345a-2de6-4160-b319-66d01334a5ad"
    --       },
    --       "Year": 2015,
    --       "Month": 8,
    --       "Activity": 24.72,
    --       "YearEndActivity": 0,
    --       "RowVersion": "-1428760384713523200"
    --     },
    --     {
    --       "Category": {
    --         "UID": "20b483b2-9a89-4793-b8c3-2da1a6284e1f",
    --         "Name": "Postman sample",
    --         "DisplayID": "Postman001",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Category/20b483b2-9a89-4793-b8c3-2da1a6284e1f"
    --       },
    --       "Account": {
    --         "UID": "40ecbafd-51c0-40f3-9a28-d6a2b6d7422a",
    --         "Name": "Produce Income",
    --         "DisplayID": "4-1000",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Account/40ecbafd-51c0-40f3-9a28-d6a2b6d7422a"
    --       },
    --       "Year": 2015,
    --       "Month": 8,
    --       "Activity": 90.91,
    --       "YearEndActivity": 0,
    --       "RowVersion": "-1572875572789379072"
    --     },
    --     {
    --       "Category": {
    --         "UID": "20b483b2-9a89-4793-b8c3-2da1a6284e1f",
    --         "Name": "Postman sample",
    --         "DisplayID": "Postman001",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Category/20b483b2-9a89-4793-b8c3-2da1a6284e1f"
    --       },
    --       "Account": {
    --         "UID": "737c0032-a48a-48fa-930e-07da50005d0b",
    --         "Name": "Cost Of Sales",
    --         "DisplayID": "5-1000",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Account/737c0032-a48a-48fa-930e-07da50005d0b"
    --       },
    --       "Year": 2015,
    --       "Month": 8,
    --       "Activity": 91.66,
    --       "YearEndActivity": 0,
    --       "RowVersion": "-1212587602599739392"
    --     },
    --     {
    --       "Category": {
    --         "UID": "20b483b2-9a89-4793-b8c3-2da1a6284e1f",
    --         "Name": "Postman sample",
    --         "DisplayID": "Postman001",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Category/20b483b2-9a89-4793-b8c3-2da1a6284e1f"
    --       },
    --       "Account": {
    --         "UID": "bb628b6e-b113-46df-bb22-cc73ebb33449",
    --         "Name": "Trade Debtors",
    --         "DisplayID": "1-1310",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Account/bb628b6e-b113-46df-bb22-cc73ebb33449"
    --       },
    --       "Year": 2015,
    --       "Month": 8,
    --       "Activity": 198.62,
    --       "YearEndActivity": 0,
    --       "RowVersion": "-1140530008561811456"
    --     },
    --     {
    --       "Category": {
    --         "UID": "20b483b2-9a89-4793-b8c3-2da1a6284e1f",
    --         "Name": "Postman sample",
    --         "DisplayID": "Postman001",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Category/20b483b2-9a89-4793-b8c3-2da1a6284e1f"
    --       },
    --       "Account": {
    --         "UID": "72bec1c2-49a6-4b02-96d0-5ee79fefdefa",
    --         "Name": "Trade Creditors",
    --         "DisplayID": "2-1510",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Account/72bec1c2-49a6-4b02-96d0-5ee79fefdefa"
    --       },
    --       "Year": 2015,
    --       "Month": 8,
    --       "Activity": 320.7,
    --       "YearEndActivity": 0,
    --       "RowVersion": "7592796292862967808"
    --     },
    --     {
    --       "Category": {
    --         "UID": "20b483b2-9a89-4793-b8c3-2da1a6284e1f",
    --         "Name": "Postman sample",
    --         "DisplayID": "Postman001",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Category/20b483b2-9a89-4793-b8c3-2da1a6284e1f"
    --       },
    --       "Account": {
    --         "UID": "6ef5febd-4027-4f87-9bb3-2f1d904eb948",
    --         "Name": "Accum. Depr. Buildings",
    --         "DisplayID": "1-2420",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Account/6ef5febd-4027-4f87-9bb3-2f1d904eb948"
    --       },
    --       "Year": 2013,
    --       "Month": 9,
    --       "Activity": 625,
    --       "YearEndActivity": 0,
    --       "RowVersion": "4263226594329362432"
    --     },
    --     {
    --       "Category": {
    --         "UID": "20b483b2-9a89-4793-b8c3-2da1a6284e1f",
    --         "Name": "Postman sample",
    --         "DisplayID": "Postman001",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Category/20b483b2-9a89-4793-b8c3-2da1a6284e1f"
    --       },
    --       "Account": {
    --         "UID": "72bec1c2-49a6-4b02-96d0-5ee79fefdefa",
    --         "Name": "Trade Creditors",
    --         "DisplayID": "2-1510",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Account/72bec1c2-49a6-4b02-96d0-5ee79fefdefa"
    --       },
    --       "Year": 2013,
    --       "Month": 9,
    --       "Activity": 698.5,
    --       "YearEndActivity": 0,
    --       "RowVersion": "4191169000291434496"
    --     },
    --     {
    --       "Category": {
    --         "UID": "80b6a90d-e22a-47e3-a5e7-a2ee9126f153",
    --         "Name": "Craigs Category",
    --         "DisplayID": "Craigs",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Category/80b6a90d-e22a-47e3-a5e7-a2ee9126f153"
    --       },
    --       "Account": {
    --         "UID": "b2ff345a-2de6-4160-b319-66d01334a5ad",
    --         "Name": "GST Collected",
    --         "DisplayID": "2-1210",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Account/b2ff345a-2de6-4160-b319-66d01334a5ad"
    --       },
    --       "Year": 2014,
    --       "Month": 1,
    --       "Activity": 909.09,
    --       "YearEndActivity": 0,
    --       "RowVersion": "-7193649382724468736"
    --     },
    --     {
    --       "Category": {
    --         "UID": "80b6a90d-e22a-47e3-a5e7-a2ee9126f153",
    --         "Name": "Craigs Category",
    --         "DisplayID": "Craigs",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Category/80b6a90d-e22a-47e3-a5e7-a2ee9126f153"
    --       },
    --       "Account": {
    --         "UID": "72bec1c2-49a6-4b02-96d0-5ee79fefdefa",
    --         "Name": "Trade Creditors",
    --         "DisplayID": "2-1510",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Account/72bec1c2-49a6-4b02-96d0-5ee79fefdefa"
    --       },
    --       "Year": 2015,
    --       "Month": 8,
    --       "Activity": 1155,
    --       "YearEndActivity": 0,
    --       "RowVersion": "1021479287552737280"
    --     },
    --     {
    --       "Category": {
    --         "UID": "80b6a90d-e22a-47e3-a5e7-a2ee9126f153",
    --         "Name": "Craigs Category",
    --         "DisplayID": "Craigs",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Category/80b6a90d-e22a-47e3-a5e7-a2ee9126f153"
    --       },
    --       "Account": {
    --         "UID": "40ecbafd-51c0-40f3-9a28-d6a2b6d7422a",
    --         "Name": "Produce Income",
    --         "DisplayID": "4-1000",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Account/40ecbafd-51c0-40f3-9a28-d6a2b6d7422a"
    --       },
    --       "Year": 2014,
    --       "Month": 1,
    --       "Activity": 9090.91,
    --       "YearEndActivity": 0,
    --       "RowVersion": "-7265706976762396672"
    --     },
    --     {
    --       "Category": {
    --         "UID": "80b6a90d-e22a-47e3-a5e7-a2ee9126f153",
    --         "Name": "Craigs Category",
    --         "DisplayID": "Craigs",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Category/80b6a90d-e22a-47e3-a5e7-a2ee9126f153"
    --       },
    --       "Account": {
    --         "UID": "bb628b6e-b113-46df-bb22-cc73ebb33449",
    --         "Name": "Trade Debtors",
    --         "DisplayID": "1-1310",
    --         "URI": "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Account/bb628b6e-b113-46df-bb22-cc73ebb33449"
    --       },
    --       "Year": 2014,
    --       "Month": 1,
    --       "Activity": 10000,
    --       "YearEndActivity": 0,
    --       "RowVersion": "-7337764570800324608"
    --     }
    --   ],
    --   "NextPageLink": null,
    --   "Count": 19
    -- }

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

    DECLARE @NextPageLink nvarchar(4000)

    DECLARE @Count int

    DECLARE @i int

    DECLARE @count_i int

    DECLARE @CategoryUID nvarchar(4000)

    DECLARE @CategoryName nvarchar(4000)

    DECLARE @CategoryDisplayID nvarchar(4000)

    DECLARE @CategoryURI nvarchar(4000)

    DECLARE @AccountUID nvarchar(4000)

    DECLARE @AccountName nvarchar(4000)

    DECLARE @AccountDisplayID nvarchar(4000)

    DECLARE @AccountURI nvarchar(4000)

    DECLARE @Year int

    DECLARE @Month int

    DECLARE @Activity int

    DECLARE @YearEndActivity int

    DECLARE @RowVersion nvarchar(4000)

    EXEC sp_OAMethod @jResp, 'StringOf', @NextPageLink OUT, 'NextPageLink'
    EXEC sp_OAMethod @jResp, 'IntOf', @Count OUT, 'Count'
    SELECT @i = 0
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'Items'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @CategoryUID OUT, 'Items[i].Category.UID'
        EXEC sp_OAMethod @jResp, 'StringOf', @CategoryName OUT, 'Items[i].Category.Name'
        EXEC sp_OAMethod @jResp, 'StringOf', @CategoryDisplayID OUT, 'Items[i].Category.DisplayID'
        EXEC sp_OAMethod @jResp, 'StringOf', @CategoryURI OUT, 'Items[i].Category.URI'
        EXEC sp_OAMethod @jResp, 'StringOf', @AccountUID OUT, 'Items[i].Account.UID'
        EXEC sp_OAMethod @jResp, 'StringOf', @AccountName OUT, 'Items[i].Account.Name'
        EXEC sp_OAMethod @jResp, 'StringOf', @AccountDisplayID OUT, 'Items[i].Account.DisplayID'
        EXEC sp_OAMethod @jResp, 'StringOf', @AccountURI OUT, 'Items[i].Account.URI'
        EXEC sp_OAMethod @jResp, 'IntOf', @Year OUT, 'Items[i].Year'
        EXEC sp_OAMethod @jResp, 'IntOf', @Month OUT, 'Items[i].Month'
        EXEC sp_OAMethod @jResp, 'IntOf', @Activity OUT, 'Items[i].Activity'
        EXEC sp_OAMethod @jResp, 'IntOf', @YearEndActivity OUT, 'Items[i].YearEndActivity'
        EXEC sp_OAMethod @jResp, 'StringOf', @RowVersion OUT, 'Items[i].RowVersion'
        SELECT @i = @i + 1
      END

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


END
GO