Anna
Anna

Reputation: 35

POST method with CURL

I'm trying to call parameterized jenkins job. When i run the job manually, the build is successful (it accept the value of the parameter). Otherwise, via CURL, the job is running, but the parameter is empty.

curl -X POST http://login:pwd@localhost:8080/buildByToken/buildWithParameters/build?job=test&token=tokenValue --data-urlencode json='{"parameter":[{"name":"fileName","value":"test"}]'

Upvotes: 0

Views: 302

Answers (1)

pii_ke
pii_ke

Reputation: 2901

Unquoted & is a special character. Everything after it is considered a separate command.

Try quoting the url as shown below.

curl -X POST 'http://login:pwd@localhost:8080/buildByToken/buildWithParameters/build?job=test&token=tokenValue' --data-urlencode json='{"parameter":[{"name":"fileName","value":"test"}]'

Upvotes: 0

Related Questions