UIPATH Orchestrator API: Upload Package

orchestrator
p_qa
api

#1

Hi community!!

I am dealing with the orchestrator API, both with Uipath HttpRequest dedicated activities, and also in python.

I am trying to perform “Upload Package” action, as follows (indicated in the API guide)(Python).


url = myOrchestratorURL + “/odata/Processes/UiPath.Server.Configuration.OData.UploadPackage”
headers = {
‘authorization’: "Bearer " + bearer,
‘content-type’: “multipart/form-data”,
}
multipart_form_data = {
‘Content-Disposition’ : ‘form-data; name=“file”; filename=“CHARO_A.1.0.6515.17422.nupkg”’,
‘Content-Type’ : ‘application/octet-stream’
}
response = requests.post(url, headers=headers , files=multipart_form_data)
print(response.text):


And the result obtained is:


{“error”:{“code”:"",“message”:“You have to upload one package.”}}


At one point I guess I am missing something, but I can’t guess… Any help would be appreciated!

Thanks a lot and have a good day


#2

I am having this exact same issue. Were you ever able to figure it out?


#3

Hello,
Is there a solution for upload packages ?


#4

I was finally able to get this to work. I am using Powershell, and the specific line of relevance is:

$status = Invoke-RestMethod -Method Post -Headers $headers -Uri ($server+$uri) -Body $bodyLines -ContentType “multipart/form-data;boundary=$boundary” -Verbose


#5

Thank You Dean,
You make us turn the right way.
We finnaly use postman to test and automate it in curl (impossible to do it in Python) :

curl -X POST https://{MY_URL}/odata/Processes/UiPath.Server.Configuration.OData.UploadPackage%28%29 -H 'Authorization: Bearer {MYTOKEN}’ -H ‘Cache-Control: no-cache’ -H ‘Postman-Token: c49b38fc-d701-4603-882a-a72e971db984’ -H ‘content-type: multipart/form-data’ -F ‘file=@/mnt/Dossier_Windows/mytest.nupkg’


#6

Your welcome @GeneraliDevops :slight_smile:


#7

Dean, Can you please explain a bit on $bodyLines and $boundary variables. ? What is supposed to be there in it. I have the same problem too. Cannot upload the packages via API call from C# or Powershell.


#8

Hi @rmadrigal,

Are you able to fix this issue? I am also trying to post a package to orchestrator from my python program but stuck with the same error you mentioned. So any suggestion or help regarding to this would be great helpful.

Thank you in advance.

Best,
Sid