Querying for build parameters

32 views
Skip to first unread message

Lakshmi Narasimhan Vaikuntam

unread,
Aug 3, 2015, 2:49:16 AM8/3/15
to Jenkins Developers
For a freestyle job, using these two apis gives the same set of parameters

1) /api/xml?tree=property[parameterDefinitions[name,type]]

2) /api/xml?tree=actions[parameterDefinitions[name,type]]

But in a workflow job, only the first one gives back the parameters. The second one returns a empty list.

I am using approach 2) to query the parameters in a job and it is broken for workflow. Is this a gap in workflow or is the right way to query build parameters is approach 1)

Jesse Glick

unread,
Aug 10, 2015, 1:30:21 PM8/10/15
to Jenkins Dev
On Mon, Aug 3, 2015 at 2:49 AM, Lakshmi Narasimhan Vaikuntam
<vaikuntam....@gmail.com> wrote:
> For a freestyle job, using these two apis gives the same set of parameters
>
> 1) /api/xml?tree=property[parameterDefinitions[name,type]]

That is right. You are looking up `ParametersDefinitionProperty`,
which is in `Job.properties` and has a `parameterDefinitions`
property. Straightforward.

> 2) /api/xml?tree=actions[parameterDefinitions[name,type]]

Seems that `ParametersDefinitionProperty` implements `getJobActions`
to return itself, though I cannot see any reason why—as an `Action` it
offers no UI or URL binding. `WorkflowJob` does not currently support
this method, for which I filed JENKINS-29880. At any rate, you should
use style (1) above.
Reply all
Reply to author
Forward
0 new messages