Chilkat Online Tools

phpAx / Orchestrator / License - Upload file

Back to Collection Items

<?php

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

$http = new COM("Chilkat_9_5_0.Http");

$req = new COM("Chilkat_9_5_0.HttpRequest");
$req->HttpVerb = 'POST';
$req->Path = '/odata/Settings/UiPath.Server.Configuration.OData.UploadLicense';
$req->ContentType = 'multipart/form-data';
$req->AddParam('','');

$req->AddHeader('Authorization','Bearer <access_token>');
$req->AddHeader('X-UIPATH-OrganizationUnitId','{{folderId}}');
$req->AddHeader('X-UIPATH-TenantName','{{tenantName}}');

// resp is a Chilkat_9_5_0.HttpResponse
$resp = $http->SynchronousRequest('domain.com',443,1,$req);
if ($http->LastMethodSuccess == 0) {
    print $http->LastErrorText . "\n";
    exit;
}

print $resp->StatusCode . "\n";
print $resp->BodyStr . "\n";


?>

Curl Command

curl -X POST
	-H "Authorization: Bearer <access_token>"
	-H "X-UIPATH-TenantName: {{tenantName}}"
	-H "X-UIPATH-OrganizationUnitId: {{folderId}}"
	--form '=@"/path/to/file"'
https://domain.com/odata/Settings/UiPath.Server.Configuration.OData.UploadLicense

Postman Collection Item JSON

{
  "name": "License - Upload file",
  "event": [
    {
      "listen": "test",
      "script": {
        "exec": [
          ""
        ],
        "type": "text/javascript"
      }
    }
  ],
  "request": {
    "method": "POST",
    "header": [
      {
        "key": "X-UIPATH-TenantName",
        "value": "{{tenantName}}",
        "type": "text"
      },
      {
        "key": "X-UIPATH-OrganizationUnitId",
        "value": "{{folderId}}",
        "type": "text"
      }
    ],
    "body": {
      "mode": "formdata",
      "formdata": [
        {
          "key": "",
          "type": "file",
          "src": [
          ]
        }
      ]
    },
    "url": {
      "raw": "{{url}}/odata/Settings/UiPath.Server.Configuration.OData.UploadLicense",
      "host": [
        "{{url}}"
      ],
      "path": [
        "odata",
        "Settings",
        "UiPath.Server.Configuration.OData.UploadLicense"
      ]
    },
    "description": "A method for manually retrieving an authentication token using the login credentials supplied in the Body. This token is then made available to all other calls."
  },
  "response": [
  ]
}