• Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • nested-view-plugin
    • None

      Create a new job in a view using REST API, like /createItem.

          [JENKINS-9264] Create a new job into a view via REST API

          these two are related

          Rüdiger zu Dohna added a comment - these two are related

          Simon Endele added a comment -

          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:
          wget --post-data='name=ViewX&JobX=on&json=

          {"name": "ViewX", "JobX": true}

          ' http://.../jenkins/view/ViewX/configSubmit

          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.

          Simon Endele added a comment - 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: wget --post-data='name=ViewX&JobX=on&json= {"name": "ViewX", "JobX": true} ' http://.../jenkins/view/ViewX/configSubmit 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.

          Simon Endele added a comment -

          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.

          Simon Endele added a comment - 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.

          dmatag added a comment -

          I think this could be closed. May I?

          dmatag added a comment - I think this could be closed. May I?

          closing, eh? at least the docu should be fixed, no?

          Rüdiger zu Dohna added a comment - closing, eh? at least the docu should be fixed, no?

          Alex Ellis added a comment -

          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

          Alex Ellis added a comment - 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

            Unassigned Unassigned
            dmatag dmatag
            Votes:
            4 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: