Forum Discussion

A_J_'s avatar
A_J_
Icon for Altostratus rankAltostratus
Mar 09, 2022

Creating a wideip using Python f5-sdk

Hello!

 I am trying to create a wideip using the 'payload' method in python, drawing all the attributes from a JSON file but I keep getting the following error:

{ "code":400,"message":"one or more configuration identifiers must be provided","errorStack":[],"apiError":26214401}

I'm not sure what I'm missing. If anyone has a sample code or could take a look, it would be greatly appreciated!

JSON:

"testwideip.com": {
        "wideipkind": "tm:gtm:wideip:a:astate",
        "lbmode": "",
        "ttl": 3600,
        "pools": [
            {
                "p1": {
                    "kind": "tm:gtm:pool:a:astate",
                    "name": "p1,
                    "partition": "Common",
                    "order": 0
                }
            }
        ]
    }
 
Python:
    with open(filename, 'r') as fh:
        content = json.load(fh)
 
    wideip = "testwideip.com"
    name = wideip
    wideipkind = content[wideip]["wideipkind"]
    lbmode = content[wideip]["lbmode"]
    ttl = content[wideip]["ttl"]
    pools = content[wideip]["pools"]
   
    payload = {}

    payload['name'] = name
    payload['kind'] = wideipkind
   
    if lbmode:
        payload['poolLbMode'] = lbmode
   
    payload['pools'] = pools
    payload['ttlPersistence'] = ttl

    mgmt.tm.gtm.wideips.a_s.a.create(**payload)