To make scripted clients (such as wget) invoke operations that require authorization (such as scheduling a build), use HTTP BASIC authentication to specify the user name and the API token. This is often more convenient than emulating the form-based authentication.
The article quote above mentions “buildToken“, but I don’t need it at all.
The article quoted above has a section on wget. It recommends using “--auth-no-challenge
” and also “--secure-protocol=TLSv1
“, but a simple “wget --http-user=user --http-password=apiToken
” works for me. The article explains, where to find the user’s apiToken (→ within the Jenkins user’s own configuration).
I also successfully tried “curl --user user:apiToken
“. wget‘s “--auth-no-challenge
” corresponds to curl‘s “--basic
“. (But I will only apply them, once I am stuck w/o them.)
My Jenkins URLs are usually actually …/api/xml ones, and I use XMLStarlet for the XPath-style extractions. My command lines look like this:
$ wget --quiet --output-document - --http-user=user --http-password=apiToken .../api/xml | xmlstartlet ... $ curl --silent --user user:apiToken .../api/xml | xmlstartlet ...
Leave a Reply