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.
-- {
-- "transactionData": {
-- "Name": "UnattendedQueue",
-- "RobotIdentifier": "863426ab-b299-4184-af7d-285a1ead6582"
-- }
-- }
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, 'transactionData.Name', 'UnattendedQueue'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'transactionData.RobotIdentifier', '863426ab-b299-4184-af7d-285a1ead6582'
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}}'
DECLARE @resp int
EXEC sp_OAMethod @http, 'PostJson3', @resp OUT, 'https://domain.com/orchestrator_/odata/Queues/UiPathODataSvc.StartTransaction', 'application/json', @json
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
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
END
GO
Curl Command
curl -X POST
-H "Authorization: Bearer <access_token>"
-H "Content-Type: application/json"
-H "X-UIPATH-OrganizationUnitId: {{folderId}}"
-d '{
"transactionData": {
"Name": "UnattendedQueue",
"RobotIdentifier": "863426ab-b299-4184-af7d-285a1ead6582"
}
}'
https://domain.com/orchestrator_/odata/Queues/UiPathODataSvc.StartTransaction
Postman Collection Item JSON
{
"name": "Start Transaction",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
},
{
"key": "X-UIPATH-OrganizationUnitId",
"value": "{{folderId}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"transactionData\": {\r\n \"Name\": \"UnattendedQueue\",\r\n \"RobotIdentifier\": \"863426ab-b299-4184-af7d-285a1ead6582\"\r\n }\r\n}"
},
"url": {
"raw": "{{url}}/orchestrator_/odata/Queues/UiPathODataSvc.StartTransaction",
"host": [
"{{url}}"
],
"path": [
"orchestrator_",
"odata",
"Queues",
"UiPathODataSvc.StartTransaction"
]
}
},
"response": [
{
"name": "Start Transaction",
"originalRequest": {
"method": "POST",
"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"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"transactionData\": {\r\n \"Name\": \"UnattendedQueue\",\r\n \"RobotIdentifier\": \"863426ab-b299-4184-af7d-285a1ead6582\"\r\n }\r\n}"
},
"url": {
"raw": "{{url}}/orchestrator_/odata/Queues/UiPathODataSvc.StartTransaction",
"host": [
"{{url}}"
],
"path": [
"orchestrator_",
"odata",
"Queues",
"UiPathODataSvc.StartTransaction"
]
}
},
"status": "No Content",
"code": 204,
"_postman_previewlanguage": "plain",
"header": [
{
"key": "Date",
"value": "Wed, 31 Mar 2021 12:55:13 GMT"
},
{
"key": "Content-Length",
"value": "0"
},
{
"key": "Connection",
"value": "keep-alive"
},
{
"key": "Cache-Control",
"value": "no-cache, no-store, must-revalidate"
},
{
"key": "Pragma",
"value": "no-cache"
},
{
"key": "Expires",
"value": "-1"
},
{
"key": "Request-Context",
"value": "appId=cid-v1:04884d99-0742-441b-a23c-847133cb0130"
},
{
"key": "X-Robots-Tag",
"value": "noindex,nofollow"
},
{
"key": "X-Download-Options",
"value": "noopen"
},
{
"key": "X-XSS-Protection",
"value": "1"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-Frame-Options",
"value": "Deny"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=31536000; includeSubDomains"
},
{
"key": "Content-Security-Policy",
"value": "default-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: https://*.blob.core.windows.net https://*.amazonaws.com blob:;font-src 'self' data:;connect-src 'self' wss: https://sentry.io https://studio-feedback.azure-api.net https://storage.googleapis.com https://*.service.signalr.net https://*.blob.core.windows.net https://*.amazonaws.com dc.services.visualstudio.com;worker-src 'self' blob:"
},
{
"key": "X-Correlation-ID",
"value": "a3b97919-ab81-4d16-88ff-46b32a822a88"
},
{
"key": "api-supported-versions",
"value": "12.0"
},
{
"key": "CF-Cache-Status",
"value": "DYNAMIC"
},
{
"key": "cf-request-id",
"value": "0929f3402a0000cba02d2d3000000001"
},
{
"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": "6389bb137ad3cba0-VIE"
}
],
"cookie": [
],
"body": null
}
]
}