Hai.. I need to send the whole json string to the jenkin's parameter. Do u 
have any idea how to do that.


On Thursday, 20 February 2020 16:00:04 UTC, Jay Hayes wrote:
>
> Fair enough but, for whatever reason, I can only get the parameters passed 
> as JSON data when I use the /build endpoint.  If I POST to the 
> /buildWithParameters endpoint, all parameters show up in the invoked build 
> but with no values (other than defaults).
>
> Using the same example with the following curl:
> curl --location --request POST 'http://XXXXXXXXXXXXXXXXXXX:8080/job/
> test-job/buildWithParameters' \
> --header 'Content-Type: application/x-www-form-urlencoded' \
> --header 'Authorization: XXXXXXXXXXXXXXXXXXXXX' \
> --data-urlencode 
> 'json={"parameter":[{"name":"required_param","value":"myValue"}]}'
>
> Yields:
> Build #11
> Parameters
>   required_param 
>   default_param 
>
>
>
>
>
>
>
>
>
>
>
> The default_param is now included with the correct default value but the 
> value passed for the required_param is missing?
>
>
>
> On Thursday, February 20, 2020 at 10:20:19 AM UTC-5, Mark Waite wrote:
>>
>> I suspect that is intentional.  I assume that the '/build' end point is 
>> not intended for use with parameters.  If you want to pass parameters, use 
>> the /buildWithParameters end point.
>>
>>
>> On Thu, Feb 20, 2020 at 7:35 AM Jay Hayes <jacky...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> This seems like a bug to me but, if so, I don't know how it hasn't been 
>>> reported which makes me think I'm overlooking something obvious.
>>>
>>> When I invoke a jenkins job via curl and send the parameters as JSON 
>>> data\payload to the job's /build endpoint any parameters I don't pass in 
>>> the payload disappear from the invoked build for that job (even if the 
>>> parameters omitted have default values).
>>>
>>> For instance, say I have a job test-job with the following parameters 
>>> defined:
>>>
>>> *String Parameter*
>>> [image: [Help]] 
>>> <http://d10b588.na.sas.com:8080/job/extend_choice_parameter_plugin_test/configure#>
>>>   Name [image: Help for feature: Name] 
>>> <http://d10b588.na.sas.com:8080/job/extend_choice_parameter_plugin_test/configure#>
>>>   Default Value [image: Help for feature: Default Value] 
>>> <http://d10b588.na.sas.com:8080/job/extend_choice_parameter_plugin_test/configure#>
>>>   Description 
>>>
>>>  [Safe HTML] Preview 
>>> <http://d10b588.na.sas.com:8080/job/extend_choice_parameter_plugin_test/configure#>
>>>  
>>> [image: Help for feature: Description] 
>>> <http://d10b588.na.sas.com:8080/job/extend_choice_parameter_plugin_test/configure#>
>>>   Trim the string [image: Help for feature: This project is 
>>> parameterized] 
>>> <http://d10b588.na.sas.com:8080/job/extend_choice_parameter_plugin_test/configure#>
>>>
>>> Delete
>>> *String Parameter*
>>> [image: [Help]] 
>>> <http://d10b588.na.sas.com:8080/job/extend_choice_parameter_plugin_test/configure#>
>>>   Name [image: Help for feature: Name] 
>>> <http://d10b588.na.sas.com:8080/job/extend_choice_parameter_plugin_test/configure#>
>>>   Default Value [image: Help for feature: Default Value] 
>>> <http://d10b588.na.sas.com:8080/job/extend_choice_parameter_plugin_test/configure#>
>>>   Description 
>>>
>>>  [Safe HTML] Preview 
>>> <http://d10b588.na.sas.com:8080/job/extend_choice_parameter_plugin_test/configure#>
>>>  
>>>
>>>
>>> If i invoke said job via curl using the /build endpoint:
>>> curl --location --request POST '
>>> http://XXXXXXXXXXXXXXX:8080/job/test-job/build' \
>>> --header 'Content-Type: application/x-www-form-urlencoded' \
>>> --header 'Authorization: XXXXXXXXXXXXXXXXXXXXXXX' \
>>> --data-urlencode 
>>> 'json={"parameter":[{"name":"required_param","value":"myValue"}]}'
>>>
>>> The default_param is dropped entirely from the resultant build:
>>>
>>> Build #8
>>> Parameters
>>>   required_param 
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Instead if I invoke the job via curl with url query params using the 
>>> /buildWithParameters endpoint it works as I would expect:
>>>
>>> curl --location --request POST 
>>> 'http://XXXXXXXXXXXXXXX:8080/job/test-job/buildWithParameters?required_param=myValue'
>>>  
>>> \
>>> --header 'Content-Type: application/x-www-form-urlencoded' \
>>> --header 'Authorization: XXXXXXXXXXXXXXXXXXXXXXX'
>>>
>>> Build #9
>>> Parameters
>>>   required_param 
>>>   default_param 
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Is there a bug with the /build endpoint WRT passing parameters as json 
>>> data?
>>>
>>> Thanks,
>>> Jay
>>>
>>>
>>>
>>> -- 
>>> 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 jenkins...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/jenkinsci-users/5313272d-8c6a-49c9-9509-94be90d71af9%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/jenkinsci-users/5313272d-8c6a-49c9-9509-94be90d71af9%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
**********************************************************************
This email is confidential and may contain copyright material of the John Lewis 
Partnership. 
If you are not the intended recipient, please notify us immediately and delete 
all copies of this message. 
(Please note that it is your responsibility to scan this message for viruses). 
Email to and from the
John Lewis Partnership is automatically monitored for operational and lawful 
business reasons.
**********************************************************************

John Lewis plc
Registered in England 233462
Registered office 171 Victoria Street London SW1E 5NN
 
Websites: https://www.johnlewis.com 
http://www.waitrose.com 
https://www.johnlewisfinance.com
http://www.johnlewispartnership.co.uk
 
**********************************************************************

-- 
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/57fa600a-69f1-4dca-8f11-5249e07c069a%40googlegroups.com.

Reply via email to