PureBasic / Orchestrator / License - Upload file
Back to Collection Items
IncludeFile "CkHttp.pb"
IncludeFile "CkHttpResponse.pb"
IncludeFile "CkHttpRequest.pb"
Procedure ChilkatExample()
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
http.i = CkHttp::ckCreate()
If http.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success.i
req.i = CkHttpRequest::ckCreate()
If req.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkHttpRequest::setCkHttpVerb(req, "POST")
CkHttpRequest::setCkPath(req, "/odata/Settings/UiPath.Server.Configuration.OData.UploadLicense")
CkHttpRequest::setCkContentType(req, "multipart/form-data")
CkHttpRequest::ckAddParam(req,"","")
CkHttpRequest::ckAddHeader(req,"Authorization","Bearer <access_token>")
CkHttpRequest::ckAddHeader(req,"X-UIPATH-OrganizationUnitId","{{folderId}}")
CkHttpRequest::ckAddHeader(req,"X-UIPATH-TenantName","{{tenantName}}")
resp.i = CkHttp::ckSynchronousRequest(http,"domain.com",443,1,req)
If CkHttp::ckLastMethodSuccess(http) = 0
Debug CkHttp::ckLastErrorText(http)
CkHttp::ckDispose(http)
CkHttpRequest::ckDispose(req)
ProcedureReturn
EndIf
Debug Str(CkHttpResponse::ckStatusCode(resp))
Debug CkHttpResponse::ckBodyStr(resp)
CkHttpResponse::ckDispose(resp)
CkHttp::ckDispose(http)
CkHttpRequest::ckDispose(req)
ProcedureReturn
EndProcedure
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": [
]
}