Or given that assuming you really want to use curl, presumably you could
reference the code base of those projects to try and see how to do it :)

Richard.

On Sat, 22 Aug 2015 6:33 am Khai Do <[email protected]> wrote:

> If you don't mind using Python, both the python-jenkins and jenkinsapi
> packages can do this for you pretty easily.  Both are wrappers around the
> Jenkins REST api so basically exactly what you are trying to do with curl.
>
>
> On Thursday, August 20, 2015 at 9:28:57 AM UTC-7, Greg Nifor wrote:
>>
>> Caused by: java.lang.NullPointerException
>>     at
>> hudson.model.FileParameterValue.&lt;init>(FileParameterValue.java:78)
>>
>>
>> On Thursday, August 20, 2015 at 9:23:53 AM UTC-7, Greg Nifor wrote:
>>>
>>> Update: Still doesn't work
>>>
>>> json='{"parameter": [{"name": "text", "value": "AA"}, {"name": "file",
>>> "value": "file0"}]}'
>>> url=<url>
>>> curl $url -F file0=@<file_path> -F json="$json" -u <user>:<pass>
>>>
>>>
>>> On Monday, August 17, 2015 at 2:42:58 PM UTC-7, Daniel Beck wrote:
>>>>
>>>> How to trigger a build with parameters is explained on the
>>>> /job/JOBNAME/api URL in Jenkins -- the wiki page on the topic is a bit
>>>> weird.
>>>>
>>>> On 17.08.2015, at 22:39, Walter Kelt <[email protected]> wrote:
>>>>
>>>> > Just looked at the Jenkins remote access api. Looks like file and
>>>> parameters need to be passed into curl in a json format. Not sure what
>>>> Jenkins version you are using, but you may want to check it out.
>>>> >
>>>> > If you are doing a parametrized build it looks to be a little more
>>>> complicated and I don't see an example using -F
>>>> >
>>>> > Sent from my iPad
>>>> >
>>>> > On Aug 17, 2015, at 4:11 PM, Greg Nifor <[email protected]>
>>>> wrote:
>>>> >
>>>> >> The job I'm triggering has two parameters, git and root. The curl
>>>> sets those and I'm able to use those in my execute shell step.
>>>> >>
>>>> >> On Monday, August 17, 2015 at 12:57:38 PM UTC-7, walter.kelt wrote:
>>>> >> Hmmm..when issuing a multipart form submission,  i wouldn't expect
>>>> the multipart parameters to become Linux shell variables unless the code
>>>> receiving the http request took the parameters and made them so. Does your
>>>> http endpoint do so ? Seems I am missing something.
>>>> >>
>>>> >> Sent from my iPad
>>>> >>
>>>> >> On Aug 17, 2015, at 3:45 PM, Greg Nifor <[email protected]>
>>>> wrote:
>>>> >>
>>>> >>> Linux, there's no errors. The command goes through, but Jenkins
>>>> doesn't pick up on the variables when I echo them out this is the output:
>>>> >>>
>>>> >>> 12:31:06
>>>> >>> + echo
>>>> >>>
>>>> >>> 12:31:06
>>>> >>> 12:31:06
>>>> >>> + echo root
>>>> >>>
>>>> >>> 12:31:06 root
>>>> >>>
>>>> >>> Top one echos git and the second one echoes root (it's default
>>>> value is root)
>>>> >>> echo $git
>>>> >>> echo $root
>>>> >>>
>>>> >>> On Monday, August 17, 2015 at 12:32:48 PM UTC-7, walter.kelt wrote:
>>>> >>> What was the error message ?  paste the most current command. Also,
>>>> windows or Linux ?
>>>> >>>
>>>> >>> Sent from my iPad
>>>> >>>
>>>> >>> On Aug 17, 2015, at 3:27 PM, Greg Nifor <[email protected]>
>>>> wrote:
>>>> >>>
>>>> >>>> That didn't work.
>>>> >>>>
>>>> >>>> On Monday, August 17, 2015 at 12:19:24 PM UTC-7, walter.kelt
>>>> wrote:
>>>> >>>> I think you need quote signs around each of the  -F items....such
>>>> as -F "git=test"
>>>> >>>>
>>>> >>>> Sent from my iPad
>>>> >>>>
>>>> >>>> On Aug 17, 2015, at 3:15 PM, Greg Nifor <[email protected]>
>>>> wrote:
>>>> >>>>
>>>> >>>>> curl -X POST localhost/job/Test/buildWithParameters -u user:pass
>>>> -F git=test -F root=root1
>>>> >>>>>
>>>> >>>>>
>>>> >>>>>
>>>> >>>>>
>>>> >>>>> On Monday, August 17, 2015 at 12:11:08 PM UTC-7, walter.kelt
>>>> wrote:
>>>> >>>>> Please paste your full curl command
>>>> >>>>>
>>>> >>>>> Sent from my iPad
>>>> >>>>>
>>>> >>>>> On Aug 17, 2015, at 3:06 PM, Greg Nifor <[email protected]>
>>>> wrote:
>>>> >>>>>
>>>> >>>>>> When I try that the variables are empty.
>>>> >>>>>>
>>>> >>>>>> On Monday, August 17, 2015 at 11:49:09 AM UTC-7, walter.kelt
>>>> wrote:
>>>> >>>>>> You need to use -F for file and -F for data.
>>>> >>>>>>
>>>> >>>>>> Sent from my iPad
>>>> >>>>>>
>>>> >>>>>> On Aug 17, 2015, at 2:41 PM, Greg Nifor <[email protected]>
>>>> wrote:
>>>> >>>>>>
>>>> >>>>>>> Is there a way to use curl to send both a file and string
>>>> parameter. I can do each individually, but not together.
>>>> >>>>>>>
>>>> >>>>>>> Works:
>>>> >>>>>>>
>>>> >>>>>>> curl -X POST <jenkins_url>/job/<job>/buildWithParameters -u
>>>> <user>:<password> -F file=@/path/to
>>>> >>>>>>>
>>>> >>>>>>> curl -X POST <jenkins_url>/job/<job>/buildWithParameters -u
>>>> <user>:<password> --data string0=foo --data string1=bar
>>>> >>>>>>>
>>>> >>>>>>> Doesn't Work:
>>>> >>>>>>>
>>>> >>>>>>> curl -X POST <jenkins_url>/job/<job>/buildWithParameters -u
>>>> <user>:<password> -F file=@/path/to --data string0=foo --data string1=bar
>>>> >>>>>>>
>>>> >>>>>>> The result I get is: Warning: You can only select one HTTP
>>>> request!
>>>> >>>>>>>
>>>> >>>>>>>
>>>> >>>>>>> Any ideas?
>>>> >>>>>>>
>>>> >>>>>>>
>>>> >>>>>>> --
>>>> >>>>>>> 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 [email protected].
>>>> >>>>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/jenkinsci-users/65067202-61bf-40b8-8509-376d5ae79589%40googlegroups.com.
>>>>
>>>> >>>>>>> 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 [email protected].
>>>> >>>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/jenkinsci-users/f0a472a1-78f1-4a96-a15c-cf116565cdf8%40googlegroups.com.
>>>>
>>>> >>>>>> 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 [email protected].
>>>> >>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/jenkinsci-users/235cdbdb-cd11-46e2-ac6e-c51787d835a3%40googlegroups.com.
>>>>
>>>> >>>>> 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 [email protected].
>>>> >>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/jenkinsci-users/17aa53ed-c460-4841-b074-4f7e83855dc0%40googlegroups.com.
>>>>
>>>> >>>> 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 [email protected].
>>>> >>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/jenkinsci-users/473e516e-f421-4b19-8a86-ed6ba6465a9f%40googlegroups.com.
>>>>
>>>> >>> 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 [email protected].
>>>> >> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/jenkinsci-users/19157462-71a5-48cc-a14d-aae7272f1559%40googlegroups.com.
>>>>
>>>> >> 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 [email protected].
>>>> > To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/jenkinsci-users/ED22D818-1ED7-4217-B112-D2AFC543847F%40comcast.net.
>>>>
>>>> > 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/4ad0d822-4323-4daa-ab09-88bed543d4da%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/4ad0d822-4323-4daa-ab09-88bed543d4da%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAMui944VmwEWDrt96K2tkUmj1T_R9ebUMZf-OgxTVAYjkuFvGw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to