Hi Rahul,

>From your query what I understood was, you've have REST API that has `n` param 
>and you want to handle each API and it's param as single resource. And if 
>that’s correct, then in that case you can write a module using HTTPAPI as 
>connection plugin handle each of APIs and its resource in particular module.

Please refer: https://docs.ansible.com/ansible/latest/plugins/httpapi.html 
<https://docs.ansible.com/ansible/latest/plugins/httpapi.html> and 
https://docs.ansible.com/ansible/latest/plugins/connection/httpapi.html 
<https://docs.ansible.com/ansible/latest/plugins/connection/httpapi.html>, this 
will guide you through the use of HTTPAPI plugin and platforms which have 
already implemented their REST APIs using the plugin.


Regards,
Sumit Jaiswal
Github/IRC: justjais

> On 12-Nov-2019, at 4:11 PM, Rahul Kumar <[email protected]> wrote:
> 
> Hi dick and all,
> Any suggestion on this ??
> 
> @ Dick 
> NO ,the uri module does not accept an ansible native format (i.e. YAML
> list) for the body parameters:  
> 
> On Tue, 5 Nov 2019 at 15:56, Rahul Kumar <[email protected] 
> <mailto:[email protected]>> wrote:
> Hi Dick ,
> Any suggestion on above query?
> 
> Rahul
> 
> On Mon, 16 Sep 2019 at 17:58, Rahul Kumar <[email protected] 
> <mailto:[email protected]>> wrote:
> Thanks Dick! Below is the task:
> 
> - name: application provisionning
>   uri:
>     url: http://{{ IP | default(ansible_fqdn) }}:8080/my-config/rest
>     body_format: json
>     method: PUT
>     body: "{{ lookup('file',app_provisioning_filepath) | from_json}}"
>     user: "{{ restapi_user }}"
>     password: "{{ restapi_password }}"
>     force_basic_auth: true
> 
> Actually problem is : This Data (Rest Response/Req.) is quite big(present in 
> file) and we want to make each key(variable) of this data in Ansible either 
> using jinja template or anything else.
> 
> Rahul
> 
> On Mon, 16 Sep 2019 at 15:24, Dick Visser <[email protected] 
> <mailto:[email protected]>> wrote:
> Hi
> 
> What do your tasks look like?
> In any case, the uri module accept an ansible native format (i.e. YAML
> list) for the body parameters:
> https://docs.ansible.com/ansible/latest/modules/uri_module.html 
> <https://docs.ansible.com/ansible/latest/modules/uri_module.html>.
> So just use that instead of an external JSON file.
> 
> 
> BTW, keywords like "urgent" tend to not work very well in community
> driven support fora.
> 
> 
> Dick
> 
> On Mon, 16 Sep 2019 at 09:30, Rahul Kumar <[email protected] 
> <mailto:[email protected]>> wrote:
> >
> > Hi Ansible Gurus, specially Dick Visser and vlado and all experts,
> > I have a question regarding Ansible Integration of REST APIs (built in 
> > JAVA). Assume I have 100 of Resource End Point( or Service End point) where 
> > each Resource can be updated/read/deleted using CURD operation. Also Each 
> > resource has almost 10-15 variables (JSON Req/Resp).
> > Currently i am using URI module for interacting these webservices but my 
> > whole JSON data is stored in raw text file. Any time i want to do any CURD 
> > opeation , i update that file and call Ansible task to perform respective 
> > CURD operation.
> >
> > Business demand is : have each REST resource parameters also configurable 
> > using ansible (rather than storing in Plain text file). What is the best 
> > way of doing this because I have many REST resources and each resource has 
> > many params.(as req./resp).
> >
> >
> > Waiting for urgent response and best solution.
> >
> > Thanks and Regards
> > Rahul
> >
> > --
> > 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] 
> > <mailto:ansible-project%[email protected]>.
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/ansible-project/CAGH8rEyBfToefFAT0KxMxEiLt_e%2BsujNnQ0snBUFbqPAZPn62w%40mail.gmail.com
> >  
> > <https://groups.google.com/d/msgid/ansible-project/CAGH8rEyBfToefFAT0KxMxEiLt_e%2BsujNnQ0snBUFbqPAZPn62w%40mail.gmail.com>.
> 
> 
> 
> -- 
> Dick Visser
> Trust & Identity Service Operations Manager
> GÉANT
> 
> -- 
> 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] 
> <mailto:ansible-project%[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/CAL8fbwNvpH4Aj%2B4nh08V1icEmk0Zg42GCKabzzFiwcXKyEij-g%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/ansible-project/CAL8fbwNvpH4Aj%2B4nh08V1icEmk0Zg42GCKabzzFiwcXKyEij-g%40mail.gmail.com>.
> 
> -- 
> 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] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/CAGH8rEwDUPbTMhp9ff2WAFzGhJTEj0xbPY7Ccqs0%2Bh4aOUSRZg%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/ansible-project/CAGH8rEwDUPbTMhp9ff2WAFzGhJTEj0xbPY7Ccqs0%2Bh4aOUSRZg%40mail.gmail.com?utm_medium=email&utm_source=footer>.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/26E772D0-AEFD-4257-BA39-14446F4AAED9%40redhat.com.

Reply via email to