Chilkat Online Tools

unicodeC / Orchestrator API Documentation / Start Transaction

Back to Collection Items

#include <C_CkHttpW.h>
#include <C_CkJsonObjectW.h>
#include <C_CkHttpResponseW.h>

void ChilkatSample(void)
    {
    HCkHttpW http;
    BOOL success;
    HCkJsonObjectW json;
    HCkHttpResponseW resp;

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

    http = CkHttpW_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 = CkJsonObjectW_Create();
    CkJsonObjectW_UpdateString(json,L"transactionData.Name",L"UnattendedQueue");
    CkJsonObjectW_UpdateString(json,L"transactionData.RobotIdentifier",L"863426ab-b299-4184-af7d-285a1ead6582");

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

    resp = CkHttpW_PostJson3(http,L"https://domain.com/orchestrator_/odata/Queues/UiPathODataSvc.StartTransaction",L"application/json",json);
    if (CkHttpW_getLastMethodSuccess(http) == FALSE) {
        wprintf(L"%s\n",CkHttpW_lastErrorText(http));
        CkHttpW_Dispose(http);
        CkJsonObjectW_Dispose(json);
        return;
    }

    wprintf(L"%d\n",CkHttpResponseW_getStatusCode(resp));
    wprintf(L"%s\n",CkHttpResponseW_bodyStr(resp));
    CkHttpResponseW_Dispose(resp);


    CkHttpW_Dispose(http);
    CkJsonObjectW_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
    }
  ]
}