Chilkat Online Tools

C / Orchestrator API Documentation / Start Transaction

Back to Collection Items

#include <C_CkHttp.h>
#include <C_CkJsonObject.h>
#include <C_CkHttpResponse.h>

void ChilkatSample(void)
    {
    HCkHttp http;
    BOOL success;
    HCkJsonObject json;
    HCkHttpResponse resp;

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

    http = CkHttp_Create();

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

    json = CkJsonObject_Create();
    CkJsonObject_UpdateString(json,"transactionData.Name","UnattendedQueue");
    CkJsonObject_UpdateString(json,"transactionData.RobotIdentifier","863426ab-b299-4184-af7d-285a1ead6582");

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

    resp = CkHttp_PostJson3(http,"https://domain.com/orchestrator_/odata/Queues/UiPathODataSvc.StartTransaction","application/json",json);
    if (CkHttp_getLastMethodSuccess(http) == FALSE) {
        printf("%s\n",CkHttp_lastErrorText(http));
        CkHttp_Dispose(http);
        CkJsonObject_Dispose(json);
        return;
    }

    printf("%d\n",CkHttpResponse_getStatusCode(resp));
    printf("%s\n",CkHttpResponse_bodyStr(resp));
    CkHttpResponse_Dispose(resp);


    CkHttp_Dispose(http);
    CkJsonObject_Dispose(json);

    }

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