Hi,
I'm trying to import a workflow to Orchestrator through the REST API, but it always end up with an error 500 :
------------------------------5bf10fbcf09
Content-Disposition: form-data; name="listVm"; filename="listVm.workflow"
Content-Type: application/zip
Binary
------------------------------5bf10fbcf09--
Here is a code that imports a workflow under a category:
I this code I am using only the Rest client that is provided with vCO:
https://vcohost:8281/api/docs/downloads.html
Hope this helps
Regards
Ivan
Your REST end point should be:
https://IP:PORT/api/content/workflows/<workflowcategory_path>
where <workflowcategory_path> is teh path to the category where you want to import the workflow
please, try it this
Regards
Ivan
Hi Ivand,
Thanks for your help.
I've just tried your advice :
https://IP:PORT/api/content/workflows/Library/Orchestrator/Workflows
But still the same error.... It seems that vCO can't read my binary... "error 500, read timeout"
Can you attached vCO server log? It is located in <vco_install_folder>/app-server/server/vmo/logs
I need to see what error is thrown
Regards
Ivan
Well, I made a mistake
You should post to https://vco:port/content/workflows/{categoryId}
where categoryId is the id of the category where you want to import the workflow
Look here in REST API docs: https://vco:port/api/docs/resource_Content%20Service.html#.content.workflows.-categoryId-
This category id can be get using GET to https://vco:port/api/categories and look for target category ID
Look here in REST API docs: https://10.23.33.55:8281/api/docs/resource_Category%20Service.html#.categories
Hope this helps
Ivan
Thanks for your quick answer
Same problem with the category....
But on documentations I've seen that you can Post this kind of request to this url : https://IP:PORT/api/workflows
https://IP:PORT/api/docs/resource_Workflow%20Service.html#.workflows
So it should work...
And in logs, the read timeout error makes me think to read problem of my binary...
Just to verify....
The request must be sent to port 8281 or 8244 ?
Thanks for your help !
The request should be sent to the SSL port, the default for this is 8281.
Ok so, I'm right on this point :
curl -i -S -k --fail -v -u "admin:pass" https://IP:8281/api/workflows -H "Content-length:19098" -F "file=@listVm.workflow"
But it still returns :
> POST /api/workflows HTTP/1.1
> Authorization: Basic Ywefklnfjkonlfe=
> User-Agent: curl/7.27.0
> Host: IP:8281
> Accept: */*
> Content-length:19098
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=----------------------------0d35baebabcc
>
* additional stuff not fine transfer.c:1037: 0 0
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 100 Continue
HTTP/1.1 100 Continue
* additional stuff not fine transfer.c:1037: 0 0
* additional stuff not fine transfer.c:1037: 0 0
* additional stuff not fine transfer.c:1037: 0 0
* additional stuff not fine transfer.c:1037: 0 0
* additional stuff not fine transfer.c:1037: 0 0
* The requested URL returned error: 500 Internal Server Error
* Closing connection #0
curl: (22) The requested URL returned error: 500 Internal Server Error
Here is a code that imports a workflow under a category:
I this code I am using only the Rest client that is provided with vCO:
https://vcohost:8281/api/docs/downloads.html
Hope this helps
Regards
Ivan
Ok thanks for these tips !! It works....:)
But if you heard about some tips for vCO Rest API Do not hesitate to up this topic !
Thanks again.
Hi clabman,
I successfully uploaded a workflow using the following content directly using HTTP POST request :
--e19b31b9-273b-4b34-b36b-5c59e1dcf326
Content-Disposition: form-data; name="file"; filename="mywf.workflow"
Content-Type: application/zip
<binary data>
--e19b31b9-273b-4b34-b36b-5c59e1dcf326
Content-Disposition: form-data; name="categoryId"
ff808081430be14fff436caace2b1742
--e19b31b9-273b-4b34-b36b-5c59e1dcf326
Content-Disposition: form-data; name="overwrite"
true
--e19b31b9-273b-4b34-b36b-5c59e1dcf326--
Be careful, if you don't have the empty line after Content-Disposition or Content-Type line, it doesn't work.
I hope it helps.
How you convert workflow file into binary data like -e19b31b9-273b-4b34-b36b-5c59e1dcf326
You need to use a file reader to convert your file content to string and insert it at the right place in the multipart "syntax" (RFC-2387).