Chilkat Online Tools

SQL Server / Orchestrator / Releases - Get all

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
    -- 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
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.Http', @http OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @success int

    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Content-Type', 'application/json'
    -- Adds the "Authorization: Bearer <access_token>" header.
    EXEC sp_OASetProperty @http, 'AuthToken', '<access_token>'
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'X-UIPATH-OrganizationUnitId', '{{folderId}}'
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'X-UIPATH-TenantName', '{{tenantName}}'

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

    EXEC sp_OAMethod @http, 'QuickGetSb', @success OUT, 'https://domain.com/odata/Releases', @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_9_5_0.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)

    -- {
    --   "@odata.context": "https://platform.uipath.com/odata/$metadata#Releases",
    --   "@odata.count": 1,
    --   "value": [
    --     {
    --       "Key": "c09b9b2a-d23c-4506-8fd2-12b0895d4031",
    --       "ProcessKey": "Heyyo",
    --       "ProcessVersion": "1.0.6786.15718",
    --       "IsLatestVersion": false,
    --       "IsProcessDeleted": false,
    --       "Description": "Test process for Postman",
    --       "Name": "Heyyo_playground",
    --       "EnvironmentId": 23282,
    --       "EnvironmentName": "playground",
    --       "Id": 31931
    --     }
    --   ]
    -- }

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

    DECLARE @Key nvarchar(4000)

    DECLARE @ProcessKey nvarchar(4000)

    DECLARE @ProcessVersion nvarchar(4000)

    DECLARE @IsLatestVersion int

    DECLARE @IsProcessDeleted int

    DECLARE @Description nvarchar(4000)

    DECLARE @Name nvarchar(4000)

    DECLARE @EnvironmentId int

    DECLARE @EnvironmentName nvarchar(4000)

    DECLARE @Id int

    DECLARE @odata_context nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @odata_context OUT, '"@odata.context"'
    DECLARE @odata_count int
    EXEC sp_OAMethod @jResp, 'IntOf', @odata_count OUT, '"@odata.count"'
    DECLARE @i int
    SELECT @i = 0
    DECLARE @count_i int
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'value'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @Key OUT, 'value[i].Key'
        EXEC sp_OAMethod @jResp, 'StringOf', @ProcessKey OUT, 'value[i].ProcessKey'
        EXEC sp_OAMethod @jResp, 'StringOf', @ProcessVersion OUT, 'value[i].ProcessVersion'
        EXEC sp_OAMethod @jResp, 'BoolOf', @IsLatestVersion OUT, 'value[i].IsLatestVersion'
        EXEC sp_OAMethod @jResp, 'BoolOf', @IsProcessDeleted OUT, 'value[i].IsProcessDeleted'
        EXEC sp_OAMethod @jResp, 'StringOf', @Description OUT, 'value[i].Description'
        EXEC sp_OAMethod @jResp, 'StringOf', @Name OUT, 'value[i].Name'
        EXEC sp_OAMethod @jResp, 'IntOf', @EnvironmentId OUT, 'value[i].EnvironmentId'
        EXEC sp_OAMethod @jResp, 'StringOf', @EnvironmentName OUT, 'value[i].EnvironmentName'
        EXEC sp_OAMethod @jResp, 'IntOf', @Id OUT, 'value[i].Id'
        SELECT @i = @i + 1
      END

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


END
GO

Curl Command

curl -X GET
	-H "Authorization: Bearer <access_token>"
	-H "Content-Type: application/json"
	-H "X-UIPATH-TenantName: {{tenantName}}"
	-H "X-UIPATH-OrganizationUnitId: {{folderId}}"
https://domain.com/odata/Releases

Postman Collection Item JSON

{
  "name": "Releases - Get all",
  "event": [
    {
      "listen": "test",
      "script": {
        "exec": [
          ""
        ],
        "type": "text/javascript"
      }
    }
  ],
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
      },
      {
        "key": "X-UIPATH-TenantName",
        "value": "{{tenantName}}",
        "type": "text"
      },
      {
        "key": "X-UIPATH-OrganizationUnitId",
        "value": "{{folderId}}",
        "type": "text"
      }
    ],
    "url": {
      "raw": "{{url}}/odata/Releases",
      "host": [
        "{{url}}"
      ],
      "path": [
        "odata",
        "Releases"
      ]
    }
  },
  "response": [
    {
      "name": "Releases - Get all",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{url}}/odata/Releases",
          "host": [
            "{{url}}"
          ],
          "path": [
            "odata",
            "Releases"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "CF-RAY",
          "value": "44302d615ada91d0-EWR",
          "name": "CF-RAY",
          "description": "Custom header"
        },
        {
          "key": "Cache-Control",
          "value": "no-store, must-revalidate, no-cache, max-age=0",
          "name": "Cache-Control",
          "description": "Tells all caching mechanisms from server to client whether they may cache this object. It is measured in seconds"
        },
        {
          "key": "Connection",
          "value": "keep-alive",
          "name": "Connection",
          "description": "Options that are desired for the connection"
        },
        {
          "key": "Content-Encoding",
          "value": "gzip",
          "name": "Content-Encoding",
          "description": "The type of encoding used on the data."
        },
        {
          "key": "Content-Length",
          "value": "381",
          "name": "Content-Length",
          "description": "The length of the response body in octets (8-bit bytes)"
        },
        {
          "key": "Content-Type",
          "value": "application/json; odata.metadata=minimal",
          "name": "Content-Type",
          "description": "The mime type of this content"
        },
        {
          "key": "Date",
          "value": "Tue, 31 Jul 2018 12:48:05 GMT",
          "name": "Date",
          "description": "The date and time that the message was sent"
        },
        {
          "key": "Expect-CT",
          "value": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"",
          "name": "Expect-CT",
          "description": "Custom header"
        },
        {
          "key": "OData-Version",
          "value": "4.0",
          "name": "OData-Version",
          "description": "Custom header"
        },
        {
          "key": "Server",
          "value": "cloudflare",
          "name": "Server",
          "description": "A name for the server"
        },
        {
          "key": "Set-Cookie",
          "value": "; SameSite=lax",
          "name": "Set-Cookie",
          "description": "an HTTP cookie"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=31536000; includeSubDomains",
          "name": "Strict-Transport-Security",
          "description": "A HSTS Policy informing the HTTP client how long to cache the HTTPS only policy and whether this applies to subdomains."
        },
        {
          "key": "Vary",
          "value": "Accept-Encoding",
          "name": "Vary",
          "description": "Tells downstream proxies how to match future request headers to decide whether the cached response can be used rather than requesting a fresh one from the origin server."
        },
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff",
          "name": "X-Content-Type-Options",
          "description": "The only defined value, \"nosniff\", prevents Internet Explorer from MIME-sniffing a response away from the declared content-type"
        },
        {
          "key": "X-Frame-Options",
          "value": "DENY",
          "name": "X-Frame-Options",
          "description": "Clickjacking protection: \"deny\" - no rendering within a frame, \"sameorigin\" - no rendering if origin mismatch"
        },
        {
          "key": "api-supported-versions",
          "value": "5.0",
          "name": "api-supported-versions",
          "description": "Custom header"
        }
      ],
      "cookie": [
        {
          "expires": "Wed Dec 19 2018 11:35:02 GMT-0600 (Central Standard Time)",
          "httpOnly": true,
          "domain": "uipath.com",
          "path": "/",
          "secure": true,
          "value": "d3b89a558feb68050f4b847c971f595771513704902",
          "key": "__cfduid"
        },
        {
          "expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
          "httpOnly": false,
          "domain": "platform.uipath.com",
          "path": "/odata/QueueProcessingRecords",
          "secure": false,
          "value": "",
          "key": ""
        },
        {
          "expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
          "httpOnly": false,
          "domain": "platform.uipath.com",
          "path": "/api/RobotsService",
          "secure": false,
          "value": "",
          "key": ""
        },
        {
          "expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
          "httpOnly": false,
          "domain": "platform.uipath.com",
          "path": "/odata/Processes",
          "secure": false,
          "value": "",
          "key": ""
        },
        {
          "expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
          "httpOnly": false,
          "domain": "platform.uipath.com",
          "path": "/odata/Settings",
          "secure": false,
          "value": "",
          "key": ""
        },
        {
          "expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
          "httpOnly": false,
          "domain": "platform.uipath.com",
          "path": "/odata/Robots",
          "secure": false,
          "value": "",
          "key": ""
        },
        {
          "expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
          "httpOnly": false,
          "domain": "platform.uipath.com",
          "path": "/odata/Queues",
          "secure": false,
          "value": "",
          "key": ""
        },
        {
          "expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
          "httpOnly": false,
          "domain": "platform.uipath.com",
          "path": "/odata/Assets",
          "secure": false,
          "value": "",
          "key": ""
        },
        {
          "expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
          "httpOnly": false,
          "domain": "platform.uipath.com",
          "path": "/api/Account",
          "secure": false,
          "value": "",
          "key": ""
        },
        {
          "expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
          "httpOnly": false,
          "domain": "platform.uipath.com",
          "path": "/odata/Users",
          "secure": false,
          "value": "",
          "key": ""
        },
        {
          "expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
          "httpOnly": false,
          "domain": "platform.uipath.com",
          "path": "/odata/Jobs",
          "secure": false,
          "value": "",
          "key": ""
        },
        {
          "expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
          "httpOnly": false,
          "domain": "platform.uipath.com",
          "path": "/api/Logs",
          "secure": false,
          "value": "",
          "key": ""
        },
        {
          "expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
          "httpOnly": false,
          "domain": "platform.uipath.com",
          "path": "/Account",
          "secure": false,
          "value": "",
          "key": ""
        },
        {
          "expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
          "httpOnly": false,
          "domain": "platform.uipath.com",
          "path": "/odata",
          "secure": false,
          "value": "",
          "key": ""
        },
        {
          "expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
          "httpOnly": false,
          "domain": "platform.uipath.com",
          "path": "/api",
          "secure": false,
          "value": "",
          "key": ""
        },
        {
          "expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
          "httpOnly": false,
          "domain": "platform.uipath.com",
          "path": "/",
          "secure": false,
          "value": "",
          "key": ""
        },
        {
          "expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
          "httpOnly": false,
          "domain": "platform.uipath.com",
          "path": "/",
          "secure": false,
          "value": "GC-osp2U-YDhoXTOqXnUp3DaN1cN_siVCaNVue_jljOcqJLYHQrRk5msz52KHL8XauydRYx_3JyjLtLDpItypCPdEL20jFnxlF2g-f86Qk41",
          "key": "__RequestVerificationToken"
        }
      ],
      "body": "{\"@odata.context\":\"https://platform.uipath.com/odata/$metadata#Releases\",\"@odata.count\":1,\"value\":[{\"Key\":\"c09b9b2a-d23c-4506-8fd2-12b0895d4031\",\"ProcessKey\":\"Heyyo\",\"ProcessVersion\":\"1.0.6786.15718\",\"IsLatestVersion\":false,\"IsProcessDeleted\":false,\"Description\":\"Test process for Postman\",\"Name\":\"Heyyo_playground\",\"EnvironmentId\":23282,\"EnvironmentName\":\"playground\",\"Id\":31931}]}"
    }
  ]
}