Forum Discussion
Modifying multiple entries in a datagroup via api?
- Nov 27, 2023
Hi Brad_Baker
You can additionally edit the content for a specific register
curl -ku "admin:Logi-123" -X PATCH -H 'Content-type: application/json' -d '{ "name":"test_domain" }' https://localhost/mgmt/tm/ltm/data-group/internal/test_domain?options=records%20modify%20%7B%20key3%20%7B%20data%20ke3new%20%7D%20%7D|jq .
as tmos you can use all of this option to interact with the data-groups
add delete modify none replace-all-with
to avoid mistakes use a tool to encode and decode the URL.
Hi Brad_Baker,
to avoid mistakes you can use this curl call format to have more clear the new records that you want to create:
curl -ku "admin:admin" -X PATCH 'https://192.168.30.1/mgmt/tm/ltm/data-group/internal/test_domain' \
--header 'Content-Type: application/json' \
--data '{
"records": [
{
"name": "domain1.com",
"data": "virtual /Common/maintenance.domain1.com_vs_443"
},
{
"name": "domain2.com",
"data": "virtual /Common/maintenance.domain2.com_vs_443"
},
{
"name": "domain3.com",
"data": "virtual /Common/maintenance.domain3.com_vs_443"
}
]
}'
- Brad_BakerNov 27, 2023Cirrus
Sebastiansierra manually add domain4.com, domain5.com and domain6.com into the datagroup from the UI. Then run the curl request above. You'll see domain4/5/6 disappear. That's what I want to prevent. I want the query to only touch domain1-3 and leave domain4-6 alone.
- Nov 27, 2023
Hi Brad_Baker,
In this post, someone found the method for making the changes in the datagroup:
Hope it works.
- Brad_BakerNov 27, 2023Cirrus
Sebastiansierra The link you provided above is in my original post. I had already found it.
Unfortunately, it seems that you can only change one record at a time using that approach.
I want to update several records at once but without performing multiple http requests and without updating every single record.
We're using this datagroup for ALL our VIPs, so if something happens to it (such as an incomplete post request, or bad regex match) all all sites stop working. Thus why I want to make changes as targeted as possible.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com