Chilkat Online Tools

Node.js / Orchestrator API Documentation / Start Transaction

Back to Collection Items

var os = require('os');
if (os.platform() == 'win32') {  
    if (os.arch() == 'ia32') {
        var chilkat = require('@chilkat/ck-node21-win-ia32');
    } else {
        var chilkat = require('@chilkat/ck-node21-win64'); 
    }
} else if (os.platform() == 'linux') {
    if (os.arch() == 'arm') {
        var chilkat = require('@chilkat/ck-node21-arm');
    } else if (os.arch() == 'x86') {
        var chilkat = require('@chilkat/ck-node21-linux32');
    } else {
        var chilkat = require('@chilkat/ck-node21-linux64');
    }
} else if (os.platform() == 'darwin') {
    if (os.arch() == 'arm64') {
        var chilkat = require('@chilkat/ck-node21-mac-m1');
    } else {
        var chilkat = require('@chilkat/ck-node21-macosx');
    }
}


function chilkatExample() {

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

    var http = new chilkat.Http();
    var success;

    // 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"
    //   }
    // }

    var json = new chilkat.JsonObject();
    json.UpdateString("transactionData.Name","UnattendedQueue");
    json.UpdateString("transactionData.RobotIdentifier","863426ab-b299-4184-af7d-285a1ead6582");

    http.SetRequestHeader("Content-Type","application/json");
    // Adds the "Authorization: Bearer <access_token>" header.
    http.AuthToken = "<access_token>";
    http.SetRequestHeader("X-UIPATH-OrganizationUnitId","{{folderId}}");

    // resp: HttpResponse
    var resp = http.PostJson3("https://domain.com/orchestrator_/odata/Queues/UiPathODataSvc.StartTransaction","application/json",json);
    if (http.LastMethodSuccess == false) {
        console.log(http.LastErrorText);
        return;
    }

    console.log(resp.StatusCode);
    console.log(resp.BodyStr);


}

chilkatExample();

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
    }
  ]
}