Forum Discussion
Sinan_WANG
Nimbostratus
Dec 01, 2016how to using rest api to create a ltm policy with asm policy?
Hi guys, I'm using rest api to create a ltm policy with asm policy, but it got a excetion. TMOS Version: 11.6.1
{u'errorStack': [], u'message': u'one or more configuration identifiers must be provided', u'code': 400}
here is my code:
!/usr/bin/env python
-*- coding=utf-8 -*-
import requests, json
requests.packages.urllib3.disable_warnings()
bigip = requests.session()
bigip.auth = ('admin', 'admin')
bigip.verify = False
bigip.headers.update({'Content-Type': 'application/json'})
创建LTM Policy
ltm_payload = {}
ltm_payload['name'] = 'demo-asm3'
ltm_payload['strategy'] = 'first-match'
ltm_payload['controls'] = ['asm']
ltm_payload['rules'] = [{'name': 'demo-asm3',
'ordinal': 1,
'actions': [{'name': 0,
'enable': True,
'asm': True,
'request': True,
'policy': 'asm-test'}
]}
]
aaa = bigip.post('https://10.10.0.21/mgmt/tm/ltm/policy', data=json.dumps(ltm_payload))
print aaa.json()
1 Reply
- Sinan_WANG
Nimbostratus
I found the problem, the actions name must be a string, can't be a integer.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
