Forum Discussion

Bastien_124165's avatar
Bastien_124165
Icon for Nimbostratus rankNimbostratus
Sep 28, 2017
Solved

POST multiple object single curl

Hello,

 

I'd like to be able to POST multiple object in a single requests. Eg, 2 datagroup

 

    {
      "records": [
        {
          "data": "Office",
          "name": "12.12.12.12/32"
        }
      ],
      "type": "ip",
      "selfLink": "https://localhost/mgmt/tm/ltm/data-group/internal/~Common~whitelist_ip?ver=13.0.0",
      "generation": 1,
      "fullPath": "/Common/whitelist_ip",
      "partition": "Common",
      "name": "whitelist_ip",
      "kind": "tm:ltm:data-group:internal:internalstate"
    },
    {
      "records": [
        {
          "data": "whatever",
          "name": "23.23.23.23/32"
        }
      ],
      "type": "ip",
      "selfLink": "https://localhost/mgmt/tm/ltm/data-group/internal/~Common~block_ip?ver=13.0.0",
      "generation": 1,
      "fullPath": "/Common/block_ip",
      "partition": "Common",
      "name": "block_ip",
      "kind": "tm:ltm:data-group:internal:internalstate"
    }


Doing it for a single object work but when I try to encapsulate both in {} or { "items": [ ] } , it doesn't work :

    {"code":403,"message":"Operation is not supported on component /ltm/data-group/internal.","errorStack":[],"apiError":1}

Is there a way to POST an existing object and replace it ? Or I have to PATCH a specific property ? Ideally I'd like to keep my full JSON object in GIT, so any time i have a change, I just need to update it and do the update. If I have no choice to use PATCH and only reset the specify property it's gonna be more complex.

 

  • Hello Bastien, Due to some internal design limitations, records of data groups are collections and not sub collections. That means to update a data group you must PATCH the entire collection of data group records (e.g. you have 100 entries in your data group and want to add one more, you send the entire data group with 101 records).

     

2 Replies

  • Hello Bastien, Due to some internal design limitations, records of data groups are collections and not sub collections. That means to update a data group you must PATCH the entire collection of data group records (e.g. you have 100 entries in your data group and want to add one more, you send the entire data group with 101 records).

     

    • JRahm's avatar
      JRahm
      Icon for Admin rankAdmin

      I'm checking on multi-post, I am not able to post two objects simultaneously. WRT to data-group records, that's a commonly misunderstood issue. I used that as one of two topics on iControl REST for this week's Post of the Week video.