Forum Discussion
JSC
Apr 26, 2017Nimbostratus
How to create GTM topology region members with iControl REST API?
We are trying to use REST iControl API in order to create a GTM topology Region /mgmt/tm/gtm/region .
The JSON structure seems to be (Obtained from a get request):
{
'fullPath': '/Commo...
JSC
May 19, 2017Nimbostratus
Only solution find, use "tmsh" command within a REST post:
if regionMembers != '':
payload={}
payload['command']='run'
payload['utilCmdArgs']="-c 'tmsh modify gtm region /"+rPartition+"/"+rName+" region-members replace-all-with { "+regionMembers+" } && if [[ $? == 0 ]] ; then echo OK ; else echo KO ; fi' | jq ."
resp = bigip.post('https://%s/mgmt/tm/util/bash?ver=12.1.2' % (BIGIP_ADDRESS), data=json.dumps(payload))
if resp.status_code == requests.codes.ok and resp.json()['commandResult'].replace('\n','') == 'OK':
print ' ~ Replace region_members = \''+str(resp.status_code)+'\' commandResult=\''+resp.json()['commandResult'].replace('\n','')+'\''
else:
print ' ~ Replace region_members = \''+str(resp.status_code)+'\' commandResult=\''+resp.json()['commandResult']+'\''
pprint(resp.json())
exit(1)
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects