REST call for list of input parameters of a Workflow before starting a job

rest
server
#1

Hi everyone, Hi @mmedzihradszky,

Is there a way to do a get/post call on a workflow on Knime server, in order to obtain the list of the accepted/waited input parameters of the workflow BEFORE the workflow has been launched?

I saw that I can obtain the list of the input-parameters with a call with the job id, but I would like to have all the possible parameters before launching the workflow.

Thanks in advance,

Lionel

0 Likes

#2

Hey Lionel,

You can make a call to the jobs endpoints of a workflow that will create a new job for you and return the list of input-parameters needed for execution without needing to execute the job first.

You will need to make a POST request and the endpoint will be in the format of http://myserver/rest/v4/respository/My_Workflow:jobs

The response payload will be very similar to the request you mentioned via the job id, it will have the input-parameters needed as well as links for executing the job if you so desire.

The response will also contain the knime:delete control if you do not wish to execute the job, you can simply discard it via the URL referenced there.

Hope this helps,
Rene Damyon

0 Likes

#3

Hi Rene,

Many thanks, with your explanations I better understood the blog posts on the subject and I could use the REST service.

Regards,

Lionel

1 Like

#4

Hi @rene.damyon,

An other question on the same subject. With the REST call “:jobs” I obtain the list of the input parameters, but can I obtain the type and options of the parameters?

For example with a workflow including 2 input quickforms : one for interger and one for multiple selection), I obtain :
“template”: {
“int-input-1185”: 5,
“multiple-selection-1171”: {
“variable_value”: [
“local”
]
}
}

But I also would like to know that:

  • the parameter “int-input-1185” is waiting for an Integer (ok I have the name of the node), and that the min and max options are set to “0” and “100”
  • the parameter “multiple-selection-1171” is waiting for a value from the fix list “local, server”

Is it possible?

thanks in advance,

Lionel

0 Likes

#5

If you are using version 4.7.0 or later of the server you can access the workflow definition via our Open API endpoint. Inside your Analytics Platform you can right click on the workflow in your server explorer and select “Show API Definition”. This will open a visualisation tool called Swagger inside your web browser that can be used to see the different interactions you have available and also to display the workflow schema.

If you scroll to the bottom of the page there should be a link labeled “Schemas” which should contain a list of all the InputParameters for that workflow as well as a type (in the case of the simpler String, Date and Number inputs at least)

Just tested that the multiple-selection input isn’t displaying a list of the expected parameters at the moment but please note this feature is very much still a work in progress and we are adding functionality to it every release. I would suggest for the meantime that if you just need to read these values and not access them programatically then you could enter them into the Description field of the input node.

You can also access this tool via the :openapi endpoint (same URL path as the :jobs endpoint) if you wish to view the openAPI definition json or :openapi?showInUI=true if you wish to launch this visualisation tool again.

Let me know if this all made sense or if you need some further clarification.

Cheers,
Rene

0 Likes

#6

I look at the Swagger service but did not manage that the type was described here (in the “Models” section and not “Schemas”).

Thanks for the end point :openapi. It is great and will do what I expect.

For the multiple-selection, at least it give the type, otherwise I should be able to use String/number quickforms inputs.

Still I did not find the possibility to obtain the min and max limit for the Integer input. Is-it possible to have these side parameters?
The Description field could be a solution, but it is an opening to errors from the user/dev.

Regards,
Lionel

0 Likes

#7

Not ideal I agree but as I mentioned before it is a work in progress feature, we will expand and enhance it over the next couple of releases to add additional information.

0 Likes

closed #8

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

0 Likes