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

Create a new job into a view via REST API

    XMLWordPrintable

Details

    Description

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

      Attachments

        Issue Links

          Activity

            these two are related

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

            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.
            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.

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

            I think this could be closed. May I?

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

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

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

            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

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

              Dates

                Created:
                Updated: