Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Answers

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.

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

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).

1
Comments on this Answer
Comment made 06-Oct-2017 by Jason Rahm

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.

0