Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-9264

Create a new job into a view via REST API

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

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

        Attachments

          Issue Links

            Activity

            Hide
            rdohna Rüdiger zu Dohna added a comment -

            these two are related

            Show
            rdohna Rüdiger zu Dohna added a comment - these two are related
            Hide
            simonendele 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.

            Show
            simonendele 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.
            Hide
            simonendele 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.

            Show
            simonendele 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.
            Hide
            dmatag dmatag added a comment -

            I think this could be closed. May I?

            Show
            dmatag dmatag added a comment - I think this could be closed. May I?
            Hide
            rdohna Rüdiger zu Dohna added a comment -

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

            Show
            rdohna Rüdiger zu Dohna added a comment - closing, eh? at least the docu should be fixed, no?
            Hide
            alexellisadp 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

            Show
            alexellisadp 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

              People

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

                Dates

                • Created:
                  Updated: