URI module - Query parameters

73 views
Skip to first unread message

Kylian B

unread,
May 4, 2021, 4:33:31 AM5/4/21
to Ansible Project
Hello,

I'm currently trying to use uri module in order to call an API. This API uses both body and query parameters. But the only way to use query parameters is to write them directly in the url. Is it the expected way of using it ?

Thank you for your answers,

Kylian.

PS :

An example :

- name: "Logout"
      uri:
        url: "{{base_url}}/a_auth_logout?token={{token}}&ServerIP={{server_ip}}"
        method: POST
        validate_certs: no
      register: logout_test

- name: "Logout expected"
      uri:
        url: "{{base_url}}/a_auth_logout"
        method: POST
        validate_certs: no
        query_parameters:
          token: {{token}}
          serverIP: {{server_ip}}
      register: logout_test

Reply all
Reply to author
Forward
0 new messages