I've been trying to execute the following curl command through the ansible uri module (the url, username, and password have been changed just for privacy)
curl -u "username:password" "https://company.abc.apps.company.eu/qps/rest/1.0/download/ca/downloadbinary/" --header "Content-Type: application/xml" --data-raw "<ServiceRequest><data><DownloadBinary><platform>LINUX_UBUNTU</platform><architecture>ARM_64</architecture></DownloadBinary></data></ServiceRequest>" -o file.deb
my current playbook task is:
- name: Download Binaries?
ansible.builtin.uri:
url: https://company.abc.apps.company.eu/qps/rest/1.0/download/ca/downloadbinary/
url_username: username
url_password: password
force_basic_auth: true
headers:
Content-Type: application/xml
body_format: raw
body: "<ServiceRequest><data><DownloadBinary><platform>LINUX_UBUNTU</platform><architecture>ARM_64</architecture></DownloadBinary></data></ServiceRequest>"
dest: file.deb
The error message I am getting from the site is the following:
<?xml version="1.0" encoding="UTF-8"?>
<ServiceResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://companty.abc.apps.company.eu/qps/xsd/1.0/ca/downloadbinary.xsd">
<responseCode>OPERATION_NOT_SUPPORTED</responseCode>
<responseErrorDetails>
<errorMessage>Operation not supported for this object using this method.</errorMessage>
<errorResolution>Refer to the QPS guide for authorized operation for this domain object.</errorResolution>
</responseErrorDetails>
</ServiceResponse>
Does anyone have any idea what I am doing wrong here?
Thanks :D
If anyone was wondering, it is a POST method. So, I needed to add method: POST
as part of the module.
- name: Download Binaries?
ansible.builtin.uri:
url: https://company.abc.apps.company.eu/qps/rest/1.0/download/ca/downloadbinary/
url_username: username
url_password: password
method: POST
force_basic_auth: true
headers:
Content-Type: application/xml
body_format: raw
body: "<ServiceRequest><data><DownloadBinary><platform>LINUX_UBUNTU</platform><architecture>ARM_64</architecture></DownloadBinary></data></ServiceRequest>"
dest: file.deb