Forum Discussion

Mohamed_Lrhazi's avatar
Mohamed_Lrhazi
Icon for Altocumulus rankAltocumulus
Jun 12, 2019

python rest api: How to get profiles details?

with code like this I can get list of virtuals and list of their applied profiles, but all I get for a profile is name and partition... How do I get the actual profile objects so I can inspect their...
  • Dario_Garrido's avatar
    Dario_Garrido
    Jun 13, 2019

    This SelfLink doesn't contain any info regarding configuration. It's only a reference pointing itself.

    Check this ->

    # curl -sku admin:XXXX https://localhost/mgmt/tm/ltm/virtual/~Common~myvirtual/profiles/~Common~tcp | json-format 
    {
      "kind": "tm:ltm:virtual:profiles:profilesstate",
      "name": "tcp",
      "partition": "Common",
      "fullPath": "/Common/tcp",
      "generation": 239,
      "selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~myvirtual/profiles/~Common~tcp?ver\u003d12.1.4.1",
      "context": "all"
    }

    But if you search just for the profile you have all the configuration ->

    # curl -sku admin:XXXX https://localhost/mgmt/tm/ltm/profile/tcp/~Common~tcp | json-format                                                
    {
      "kind": "tm:ltm:profile:tcp:tcpstate",
      "name": "tcp",
      "partition": "Common",
      "fullPath": "/Common/tcp",
      "generation": 1,
      "selfLink": "https://localhost/mgmt/tm/ltm/profile/tcp/~Common~tcp?ver\u003d12.1.4.1",
      "abc": "enabled",
      "ackOnPush": "enabled",
      "closeWaitTimeout": 5,
      ...
    }

    So, as I have already said, you need to capture both queries and associate them.

    KR,

    Dario.