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,
I finally found the solution to modify more than one register, it uses the method option to call tmos, so you have to adapt the URL to tmos code and it works, in my example, I have added two records, key3, and key4 in the same call:
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%20add%20%7b%20key3%20%7b%20data%20value3%20%7d%20key4%20%7b%20data%20value4%20%7d%20%7d |jq .
I used notepad++ to decode and encode the URL and it looks like:
curl -ku "admin:admin" -X PATCH -H 'Content-type: application/json' -d '{ "name":"test_domain" }' https://localhost/mgmt/tm/ltm/data-group/internal/test_domain?options=records add { key3 { data value3 } key4 { data value4 } } |jq .
Hope it works.
- 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.
- Brad_BakerNov 28, 2023Cirrus
Perfect - that's exactly what I was trying to do! I was just using add instead of modify - it seems that was the issue.
Thank you so much figuring that out! 🙂 Now I don't have to worry about accidentally messing up any other datagroup records during an update.
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