Forum Discussion

janholtz's avatar
janholtz
Icon for Altostratus rankAltostratus
Apr 23, 2019

Internal datagroup REST / curl problem

What is the correct format for a file to populate an internal data group with a curl command?

 

I tried:

 

curl -vk -u xxxxx:xxxxx -H 'Content-Type:application/json' -X POST -d text.json

 

And in text.json I have the content of: curl -vk -u xxxxx:xxxxx -H "Content-Type:application/json" -X GET -o text.json

 

Surely the format of the records from a GET are correct for the format of records for a POST??? (I tried a PUT too, no joy).

 

Jan

 

1 Reply

  • Hi Jan,

    the raw GET output can't be used to create or update a given data-group.

    To create a new data-group:

    curl -k -u "admin:admin" -H "Content-Type: application/json" -X  POST -d '{"name":"DG_SOMEVALUES","type":"string","records":[{"name":"123","data":"abc"}]}' https://172.22.17.1/mgmt/tm/ltm/data-group/internal/
    

    To update the records of an existing data-group:

    curl -k -u "admin:admin" -H "Content-Type: application/json" -X  PATCH -d '{"records":[{"name":"1234","data":"xyz"}]}' https://172.22.17.1/mgmt/tm/ltm/data-group/internal/~Common~DG_SOMEVALUES
    

    Cheers, Kai