More progress - I changed buildWithParameters to just build and it seems to work. No to replace strings with variables in the JSON string
Tim On Wednesday, September 14, 2016 at 7:50:57 AM UTC-7, [email protected] wrote: > > > > down votefavorite > <http://stackoverflow.com/questions/39479258/using-curl-to-trigger-a-build-on-jenkins#> > > I am trying to write a bash script to start a build on Jenkins. It works > but the problem I am having is with passing parameter values. > > I have: curl -X POST $Server -d token='MyToken' --data-urlencode json='{ > ... }' and I want to replace the json='{...}' with a variable as in > json=$Params where my json string is '{"parameters": [{"name":"USER", > "value":"Tim"}]}' > > This json string works when I specify it on the command line but not > however when I put it in a variable. With the variable I get a stack trace > and html - several screens worth. > > When assigning to a variable a have tried several things though currently > I have Params="{\"parameters\": [{\"name\":\"USER\", \"value\":\"Tim\"}]}" > > It appears that it can't parse my json when I pass it through $Params but > can in the other case. > > What I am trying to do is get the user name passed in from a perforce > trigger, then get that users email address. I have that working assigning > to a variable @UserEMail. I then want to pass that in the json value. I > haven't gotten to the point of replacing "Tim" with the value from > @UserEmail. > > Thank you for any help. > -- 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/284f500a-d660-4377-933a-3fb87410030d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
