The "mode" parameter is expected here since you are triggering a job copy
instead of a job creation (it's the same API endpoint, it differs only with
the number/kind of parameters).

To trigger a job creation, you need something like :

curl -v -XPOST 'http://
<JENKINS_IP>:<JENKINS_PORT>/createItem?name=bimbilimbimbim' --data-binary
@config.xml -H "Content-Type:text/xml" --user <username>:<API-Token>

With *config.xml *is a local file containing your new job configuration.

You can go to http://${JENKINS_IP}:${JENKINS_PORT}/api  with your browser
to have documentation about that (*Create Job* and *Copy Job*).

Hopefully it helps.


2017-07-31 3:44 GMT+02:00 Pradeep Patra <smilesonisa...@gmail.com>:

>
>
> On Monday, July 31, 2017 at 7:21:08 AM UTC+8, mpapo - Michael Pailloncy
> wrote:
>>
>>
>>> I tried it and it is asking for mode? I am not sure what is the mode I
>>> should provide for creating new job. I tried passing  mode=create and it
>>> did not work.
>>>
>>
>> Can you share the command line which you've tried please ?
>>
>
> I planned to first try in GUI: http://<Jenkins-URL>:8080/
> createItem?name=testjob it gave me error that please specify a valid
> mode. Then I changed it to name=testjob & mode=create but it still did not
> work.
>
> curl -v -X POST http://<username>:<jenkins-pass>@<Machine-IP>:8080/
> createItem?name=newjob  –user <username>:<API-Token> --data-urlencode
> json='{"parameter": [{"name":"id", "value":"123"}, {"name":"verbosity",
> "value":"high"}]}'
>
> Can you please help here in this regard?
>
>>
>>
>>>
>>>> However, what do you mean by "for creating jobs based on a specific
>>>> build" ?
>>>>
>>>
>>> I mean the new job should "execute shell" to package local packages. I
>>> guess that I can achieve with the buildWithParameters and by passing the
>>> command. If  you have any example could you please let me know.
>>>
>>
>> You can find an example of a build trigger with parameters from command
>> line here
>> <https://wiki.jenkins.io/display/jenkins/remote+access+api#RemoteaccessAPI-Submittingjobs>
>> .
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jenkinsci-users/c8f8ba34-8af7-4a5a-8de6-b98f88b821c1%40googlegroups.
> com
> <https://groups.google.com/d/msgid/jenkinsci-users/c8f8ba34-8af7-4a5a-8de6-b98f88b821c1%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAPO77c0JdJ7V23KH9saGzV8MYikEPz_%2BDcU%2BOKdJo7U6aVyRZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to