Here is the snipped from the playbook for "GET" request task:
- name: Enable feature bit/parameters
uri:
url: https://<API REQUEST URL >
method: GET
return_content: yes
status_code: 200
headers:
Content-Type: application/json
Cookie: "{{ login.set_cookie.split(';')[0] }}"
body_format: json
register: api_result
tags: enable_stay_sec
changed_when: false
failed_when: api_result.status != 200
- debug:
msg: "{{ api_result }}"
On Tuesday, February 26, 2019 at 6:05:48 PM UTC-8, [email protected]
wrote:
>
> Hello There,
>
> I have the below GET response for a feature API request. I would like to
> update the values for the corresponding parameters as follows in the json
> object:
>
>
> *"paramValue": 15*
>
> *"configState": "ENABLE"*
>
> *GET Response output: *
>
> TASK [debug]
> *********************************************************************************************************************
> ok: [localhost] => {
> "msg": {
> "changed": false,
> "connection": "close",
> "content_length": "126",
> "content_type": "application/json",
> "cookies": {},
> "date": "Wed, 27 Feb 2019 01:47:59 GMT",
> "failed": false,
> "json": {
> "configClass": "MASTER",
> "configState": "DISABLE",
> "id": "FEATURE-BIT",
> "instanceId": 0,
> "paramValue": 0,
> },
> "msg": "OK (126 bytes)",
> "redirected": false,
> "status": 200,
> }
> }
>
> I am not sure of the syntax, how to update the values/flags in the json
> object and send POST request using URI module. Please advice ?
>
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/846d150b-278a-48bf-b1dd-a814370c7069%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.