On 12/14/19 12:46 AM, Nicholas Britton wrote:
> The problem is I don't know how to make ansible send the right bracket. 
> Testing from swagger I know what it expects. 
> 

Hello Nicholas,

try to use a list instead of a dict:

data:
  - type: storageServer
    id: 'PureDisk:server.domain'

Regards
        Racke

> On Fri, Dec 13, 2019, 5:16 PM Dick Visser <[email protected] 
> <mailto:[email protected]>> wrote:
> 
>     You’re sending something that doesn’t work, and you seem to know exactly 
> what the problem is, and also what format
>     _does_ work. So the solution is... send that?
> 
>     Or am I missing something
> 
> 
> 
>     On Fri, 13 Dec 2019 at 22:09, Nicholas Britton 
> <[email protected] <mailto:[email protected]>> wrote:
> 
>         I am working on some uri calls with netbackup and with swagger shows 
> that it only works with [] but the uri
>         modual is using {}.   Any thoughts or tricks to get that to format 
> correctly?
> 
> 
>         For example i am sending a body uri body of:
> 
>         |
>           - name: Create MSDP Disk Pool
>             uri:
>               url: "{{baseurl}}storage/disk-pools"
>               method: POST
>               body_format: json
>               status_code: 201
>               headers:
>                 authorization: "{{login.json.token}}"
>                 content-type: application/vnd.netbackup+json;version=3.0
>               body:
>                 data:
>                   type: diskPool
>                   attributes:
>                     name: server_dpm
>                     diskVolumes:
>                       [name: PureDiskVolume]
>                     maximumIoStreams:
>                       limitIoStreams: true
>                       streamsPerVolume: 75
>                  relationships:
>                     storageServers:
>                       data:
>                         type: storageServer
>                         id: 'PureDisk:server.domain'
>               validate_certs: no
>               return_content: yes
>             register: dp_create
> 
>         |
> 
>         Which produces this:
> 
>         |
>                     "body": {
>                         "data": {
>                             "attributes": {
>                                 "diskVolumes": [
>                                     {
>                                         "name": "PureDiskVolume"
>                                     }
>                                 ],
>                                 "maximumIoStreams": {
>                                     "limitIoStreams": true,
>                                     "streamsPerVolume": 75
>                                 },
>                                 "name": "server_dpm"
>                             },
>                             "relationships": {
>                                 "storageServers": {
>                                     "data": {
>                                         "id": "PureDisk:server.domain",
>                                         "type": "storageServer"
>                                     }
>                                 }
>                             },
>                             "type": "diskPool"
>                         }
>                     },
> 
> 
>         |
> 
>         While swagger produces it as this:
> 
>         |
>         working:
> 
> 
>         {
>           "data": {
>             "type": "diskPool",
>             "attributes": {
>               "name": "server_dpm",
>               "diskVolumes": [
>                 {
>                   "name": "PureDiskVolume"
>                 }
>               ],
>               
>               "maximumIoStreams": {
>                 "limitIoStreams": true,
>                 "streamsPerVolume": 75
>               }
>               
>             },
>             "relationships": {
>               "storageServers": {
>                "data": [
>                   {
>                     "type": "storageServer",
>                     "id": "PureDisk:server.domain"
>                   }
>                 ]
>               }
>             }
>           }
>         }
>         |
> 
> 
> 
>         -- 
>         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/d248f94f-431a-43d7-8ab3-08d9ae619796%40googlegroups.com
>         
> <https://groups.google.com/d/msgid/ansible-project/d248f94f-431a-43d7-8ab3-08d9ae619796%40googlegroups.com?utm_medium=email&utm_source=footer>.
> 
>     -- 
>     Sent from a mobile device - please excuse the brevity, spelling and 
> punctuation.
> 
>     -- 
>     You received this message because you are subscribed to a topic in the 
> Google Groups "Ansible Project" group.
>     To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/ansible-project/Aci8dPvAc1A/unsubscribe.
>     To unsubscribe from this group and all its topics, 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/CAL8fbwP%3DaETutURieZSYAD%2B%2B71--zX%2BNHOY4y7EGXLtp98Eozg%40mail.gmail.com
>     
> <https://groups.google.com/d/msgid/ansible-project/CAL8fbwP%3DaETutURieZSYAD%2B%2B71--zX%2BNHOY4y7EGXLtp98Eozg%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] 
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAN946jTZfpZShJGx5cTP%3D8KcpzFBoyRkZjt3EcufqyZD3OHSmQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAN946jTZfpZShJGx5cTP%3D8KcpzFBoyRkZjt3EcufqyZD3OHSmQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
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/1d07241b-9886-ce52-0ba9-61edcacd8c40%40linuxia.de.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to