I am trying to build a UI based in Angular to retrieve all existing execution lists of Tosca. However, I could not find a REST API that can give the list of folders within a workspace in Tosca. Has anyone tried this route?
1 Answers
You can use the Search
task on the project
to find all ExecutionList
s.
Example:
{rest_url}/ToscaCommander/{workspace_name}/object/project/task/Search
as a post
request with the xml payload:
<Parameters xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Parameter>
<Name>tqlString</Name>
<Type i:nil="true"/>
<Value>->SUBPARTS:TCFolder[Name=?"Execution"]=>SUBPARTS:ExecutionList</Value>
</Parameter>
</Parameters>
This will give you a list of object ids of the ExecustionList
s contained in the Execution
folder of the project
. You can fetch the objects one by one with this request afterwards:
{rest_url}/ToscaCommander/{workspace_name}/object/{object_id}
Credits for this solution go to the development team of ToscaCommander - they provided it.
P.S.: as an answer for your comment:
Yes, there is a json equivalent of the body - but you do not need it. Anyway, here is the equivalent:
[{ "Name":"tqlString", "Value":"->SUBPARTS:TCFolder[Name=?\"Execution\"]=>SUBPARTS:ExecutionList" }]
If you want to get a json response (regardless of the request's payload's format) make sure your
web.config
setsAutomaticFormatSelectionEnabled
to true (which should be the case). Then, in your requests, set theaccept
header accordingly:Accept: application/json

- 316
- 1
- 4
-
is there a json equivalent to the xml payload so i can get json object response? – arn-arn Nov 14 '17 at 20:01
-
I updated my answer to include answer for your two subsequent questions (json payload for requests, json formatted responses) – antipodos Nov 16 '17 at 10:44
-
1thanks Antipodos for being generous with your knowledge... it worked... – arn-arn Nov 16 '17 at 14:00
-
I have a follow up question which I posted in this: https://stackoverflow.com/questions/47333467/access-control-allow-origin-accessing-rest-api-of-tosca Basically, I am calling the tosca rest api from my server and it's giving me "No Access-Control-Allow-Origin" exception. Calling it from the rest client app is good but when I am calling it from the web server, it's giving me that error. – arn-arn Nov 16 '17 at 15:30