SQL Server / Orchestrator / Folders - 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
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
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-TenantName', '{{tenantName}}'
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 @http, 'QuickGetSb', @success OUT, 'https://domain.com/odata/Folders', @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
EXEC sp_OAGetProperty @http, 'LastStatus', @iTmp0 OUT
PRINT 'Response status code = ' + @iTmp0
EXEC sp_OAMethod @sbResponseBody, 'GetAsString', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @sbResponseBody
END
GO
Curl Command
curl -X GET
-H "Authorization: Bearer <access_token>"
-H "Content-Type: application/json"
-H "X-UIPATH-TenantName: {{tenantName}}"
https://domain.com/odata/Folders
Postman Collection Item JSON
{
"name": "Folders - Get all",
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
},
{
"key": "X-UIPATH-TenantName",
"value": "{{tenantName}}",
"type": "text"
}
],
"url": {
"raw": "{{url}}/odata/Folders",
"host": [
"{{url}}"
],
"path": [
"odata",
"Folders"
]
},
"description": "Experimental Feature: Retrieves all Organization Units."
},
"response": [
{
"name": "Organization Units - Get all",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"url": {
"raw": "{{url}}/odata/OrganizationUnits",
"host": [
"{{url}}"
],
"path": [
"odata",
"OrganizationUnits"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "html",
"header": [
{
"key": "Date",
"value": "Wed, 27 Feb 2019 13:49:44 GMT"
},
{
"key": "Content-Type",
"value": "text/html; charset=utf-8"
},
{
"key": "Content-Length",
"value": "1028"
},
{
"key": "Connection",
"value": "keep-alive"
},
{
"key": "Cache-Control",
"value": "no-cache, no-store, must-revalidate"
},
{
"key": "Pragma",
"value": "no-cache"
},
{
"key": "Content-Encoding",
"value": "gzip"
},
{
"key": "Expires",
"value": "-1"
},
{
"key": "Vary",
"value": "Accept-Encoding"
},
{
"key": "Set-Cookie",
"value": "XSRF-TOKEN=eJhbVvmvo60rErmC3ydbu-EewNysAnyf6tCKVomQvy2n_wBJwC_MQ081rGozSsQ0cryKgfkNmzTmo373xIZ0cwh9Z_rgUXedq8C0YcSTa5PVnatXsl0ELqFvp0aXZG96RXPx9CLeUj_hnbXAZbWC4w2; path=/; secure; SameSite=lax"
},
{
"key": "X-Robots-Tag",
"value": "noindex, nofollow"
},
{
"key": "X-Download-Options",
"value": "noopen"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
},
{
"key": "Content-Security-Policy",
"value": "default-src 'self';script-src 'self' cdn.mxpnl.com;style-src 'self' 'unsafe-inline';img-src 'self' data:;connect-src 'self' ws: wss: api.mixpanel.com https: sentry.io"
},
{
"key": "Request-Context",
"value": "appId=cid-v1:d00ce63d-0891-41e4-a17c-25b2c5382e49"
},
{
"key": "Access-Control-Expose-Headers",
"value": "Request-Context"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-Frame-Options",
"value": "DENY"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=31536000; includeSubDomains"
},
{
"key": "Expect-CT",
"value": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\""
},
{
"key": "Server",
"value": "cloudflare"
},
{
"key": "CF-RAY",
"value": "4afb1dd2abf16439-FRA"
}
],
"cookie": [
],
"body": "{\n \"@odata.context\": \"https://beta.uipath.com/odata/$metadata#OrganizationUnits\",\n \"@odata.count\": 2,\n \"value\": [\n {\n \"DisplayName\": \"Default\",\n \"Id\": 715\n },\n {\n \"DisplayName\": \"a\",\n \"Id\": 846\n }\n ]\n}"
}
]
}