Status: Open (View Workflow)
Create a new job in a view using REST API, like /createItem.
- is related to
JENKINS-8927 Create a view from the XML API
JENKINS-41128 createItem in View not working when posting xml
I think, it would be ok, to be able to add an existing job to an existing view.
Actually this can be done like follows:
But the problem is, that all other options are deleted (other assigned jobs, columns etc.).
I suggest to fix this and leave unspecified options unchanged.
Additionally the necessity to specify all options twice (see
JENKINS-8927) should be removed.
Found out how to achieve this: Instead of using /jenkins/createItem (as mentioned in the documentation), one can simply post a new job to /jenkins/view/myViewName/createItem (where myViewName is an existing view). Or in detail:
wget --post-file=config.xml --header='Content-type: application/xml; charset=ISO-8859-1' http://.../jenkins/view/myViewName/createItem?name=newJobName
Maybe this should be mentioned in the small Remote API Documentation reachable at /jenkins/api/ in every Jenkins installation, as it seems to work perfekt without any side effects.
This feature was implemented (fixed) and working, then unfortunately regression was introduced in 2.x see also: https://issues.jenkins-ci.org/browse/JENKINS-41128
these two are related