Forum Discussion

JAPortal's avatar
JAPortal
Icon for Nimbostratus rankNimbostratus
Jul 16, 2019

Using the Rest API to extract the virtual server's advanced settings

I've been trying with the REST API to save all of our virtual server's configuration (every variable that can be accessed and changed through the web interface / console) in a file. I have found the "virtual/virtualServerName" method that returns some of the things I want; but I cannot find a way to retrieve all of the virtual server's properties of one server. Is it possible to do this through the API?

  • How much info do you need....? You can add the expandSubcollections query parameter to your call to expand the config returned - https://x.x.x.x/mgmt/tm/ltm/virtual/vip_name/?expandSubcollections=true

     

    Or if you want output like tmsh list ltm virtual vip_name all-properties you can run the command using the api bash util as detailed here - https://devcentral.f5.com/s/question/0D51T00006i7fLs/native-tmshbash-commands-via-rest-api

     

    So call would be something like

     

    curl -sk -u 'admin:admin' -X POST -H "Content-type: application/json" -d "{\"command\":\"run\", \"utilCmdArgs\": \"-c 'tmsh list ltm virtual vip_name all-properties'\"}" https://x.x.x.x/mgmt/tm/util/bash | sed 's/\\n/\n/g'

  • >> now the API is not responding anymore

    You may want to try restarting the iControl REST process(es) on your BIG-IP.

    # tmsh restart sys service restjavad

     

    WRT the virtual's properies, the list is shown in the API Guide. If you cannot find the property you are after in this doc, please provide the (tmsh) property name.