The Jenkins wiki describes how to authenticate with scripts . The short answer. Go to the “Settings” screen from your user page and get the API token, and then use it as a password when running the script.
I have not tried it with the Backup plugin, but it works to run regular collections, so it should work for any script call.
No Authentication:
$ curl http://jenkins:8080/job/my%20job/build [ HTML page saying "Authentication required" ]
Authenticated:
$ curl --user dbacher:$MY_API_TOKEN http://jenkins:8080/job/my%20job/build [ returns nothing and the build starts ]
Update : misspelled missions, thanks for the comments.
source share