Hi Mohammed, I think if you only write this, it works : - contentDetails: "{{ input }}"
The Jinja will interpretes the variable "input", and it's an array. -- [image: Kosmos] <https://www.kosmos-education.com> Didier BOURRIAUD *Expert Technique* Tél. : +33 (0) 6.84.18.76.21 <undefined> - 8 rue Kervégan 44000 Nantes - France [image: Twitter] <https://twitter.com/KosmosEducation> [image: Linkedin] <https://fr.linkedin.com/company/kosmos_2> [image: Youtube] <https://www.youtube.com/user/kosmoseducation> www.kosmos-education.com [image: Qualiopi] <https://www.skolengo.com/fr/accompagnement/formation> Le mer. 14 déc. 2022 à 21:58, Mohammed Reehan <mohd.ree...@gmail.com> a écrit : > Hi Ansible Experts, > > I am trying to use Ansible URI as below to post the content where my > input is a variable of type Array in the body. > I am trying to pass the input as an Array into the body under > Contentdetials which is an array. however, it is ending up reading as a > string. > any idea how can I achieve this? i tried with With_items to loop the input > but it is not working. > I have also pasted my JSON (JS body below) and input it as an array. > > Looking forward to hearing from you and helping with this > > Regards > Reehan > ansible.builtin.uri: > url: "https://vrclm.dev.local/lcm/cms/api/vl/contents/pipelines" > method: POST > headers: > Cookie: "JSESSIONID={{ vrlcm api auth token }}" > HEADER Content-Type: "{{ http content type }}" > validate certs: "(( http validate certs }]" > status code: [201] > force basic auth: false > use proxy: false > http agent: "ansible-httppost" > body format: "json" > body: > name: "[[ vrlcm pipeline name }}" > stages: > - comments: "workflow via Ansible" > endpoints: > - "http://VRA.dev.loc" > TagName: [] > Contents: > - contentDetials: > - contentName: >- > - "{{ input }}" > isDisabled: false > contentYpe: "vra" > contentVersionIds: [] > > input: [ { "contentName" : "Contentl - > [id=62680318-7829-4e35-b5d7-62eb7c52b46c, project=Dev]"}, { "contentName": > "Content2 [id=2d29e4af-6889-459-a7f5-5af522a7ab7f, project=Dev]"}] > > { > "name": "test", > "stage":[ > { > "comment": "test", > "endpointids": [ > "vradev.local" > ], > "tagNames": [], > "Contents":[ > { > "contentDetails": [ > { > "contentName": "Contentl - > [id=62680318-7829-4e35-b5d7-62eb7c52b46c, project=Dev]" > }, > { > "contentName": "Content2 - > [id=62680318-7829-4e35-b5d7-62eb7c52b46c, project=Dev]" > } > ], > "isdisabled": false, > "contentType": "vra" > } > ], > } > ] > } > > -- > Mohammed Rehan > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Development" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to ansible-devel+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-devel/CAJOW%3Dx8HRtM68e67UZ8iw98Xh-u%2Bbjxss2xtXOk_EoH05-Ls0g%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-devel/CAJOW%3Dx8HRtM68e67UZ8iw98Xh-u%2Bbjxss2xtXOk_EoH05-Ls0g%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Ansible Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/CAAKfPhqdfBy2BnRrgePZq7J8n-F-N_%2Bvp_uyeXVo0XrtXhCMgw%40mail.gmail.com.