cURL to call REST Api

12,651

Your command seems to have an extra quote at the end of your command

Using a pem file to authenticate with curl:

curl -E /path/to/user-cert.pem -X POST https://bamboo.url/builds/rest/api/latest/queue/project_name

The file should have both private key and public key inside.

Share:
12,651
user3437721
Author by

user3437721

Updated on June 26, 2022

Comments

  • user3437721
    user3437721 almost 2 years

    So I want to call a REST API from Bamboo after a deployment has completed. This API needs a username and password but it can't be stored in Bamboo as it seems it can be viewed in the Bash History of the Build agent.

    I intended to use a script task and execute something like

    curl -f -v -k --user "${bamboo.user}":"${bamboo.password}" -X POST https://bamboo.url/builds/rest/api/latest/queue/project_name"/
    

    This would make the REST call. But the username and password is a problem.

    I do have the option, however of using a PEM file. It can be provided so does anyone know if this can be used in conjunction with the cURL?

    --OR--

    One other thought- could I encrypt a password within a file in my source control, and somehow decrypt it on the build agent, and then have curl use the file instead of reading the password from the command line? How would this look in cURL?

    Any ideas how this could be achieved?