# Trying to create VIPs via Python and get an error

**URL:** <https://community.f5.com/t/trying-to-create-vips-via-python-and-get-an-error/60249>\
**Category:** Technical Forums\
**Tags:** devops, ltm\
**Created:** [February 2, 2021, 6:42pm UTC](https://community.f5.com/t/trying-to-create-vips-via-python-and-get-an-error/60249 "2021-02-02T18:42:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maylin](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Maylin](https://community.f5.com/u/Maylin)\
**Post date:** [February 2, 2021, 6:42pm UTC](https://community.f5.com/t/trying-to-create-vips-via-python-and-get-an-error/60249/1 "2021-02-02T18:42:21Z")

</div>

Here is the snippet of code that is used to create the VIPs on the f5;

rv0=revisedServer.replace(“dev\_”,“test\_vip\_”)

print (eachServer[0][3].upper())

rv1=eachServer[0][3].upper()

params = {‘name’: rv0, ‘source’: “0.0.0.0/0”, ‘description’: “TEST VS”,‘protocol’: rv1,‘pool’: revisedServer,‘profiles’: profiles,‘partition’: ‘Common’,‘sourceAddressTranslation’: {‘type’: ‘snat’},‘vlansEnabled’: ‘True’,‘vlans’: [‘/Common/Dev’],‘arp’:‘disabled’,‘icmpecho’:‘disabled’,‘state’:‘disabled’,‘port’:eachServer[0][1],‘tagMode’:‘none’}

print (params)

#LETS CREATE VIRTIUAL SERVERS IF THE SERVER ALREADY EXISTS KEEP IT MOVING

try:

ltm.virtuals.virtual.create(\*\*params)

except Exception as e:

print (e)

When run I get the following error:

400 Unexpected Error: Bad Request for uri: [https://pltbigip01.pexdev.corp:443/mgmt/tm/ltm/virtual/](https://pltbigip01.pexdev.corp:443/mgmt/tm/ltm/virtual/)

Text: ‘{“code”:400,“message”:“Instance contains a string”,“errorStack”:[],“apiError”:1}’

Does anyone know why?

---

<div class="post-metadata">

**Author:** ![PSilva](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/psilva/32/13901_2.png) [@PSilva](https://community.f5.com/u/PSilva)\
**Post date:** [February 3, 2021, 12:21am UTC](https://community.f5.com/t/trying-to-create-vips-via-python-and-get-an-error/60249/2 "2021-02-03T00:21:35Z")

</div>

While I don’t have a direct answer, this link has some Python resources that might help? [DevCentral - An F5 Technical Community](https://devcentral.f5.com/s/feed/0D51T00006i7jgRSAQ)

And, this is the **F5 Python SDK Documentation**

> **[F5 Python SDK Documentation — F5 Python SDK 3.0.20 documentation](https://f5-sdk.readthedocs.io/en/latest/)**

Also, &nbsp;might have some insight.

Hope that helps.

ps

---

<div class="post-metadata">

**Author:** ![JRahm](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/jrahm/32/3327_2.png) [@JRahm](https://community.f5.com/u/JRahm)\
**Post date:** [February 3, 2021, 12:26am UTC](https://community.f5.com/t/trying-to-create-vips-via-python-and-get-an-error/60249/3 "2021-02-03T00:26:46Z")

</div>

if you reformat your code there to use the codeblock, it’ll be helpful. I can take a look a little later tonight to see what’s going on. In the meantime, if you’re just getting started with f5-common-python, I’d recommend you take a look at [bigrest](https://bigrest.readthedocs.io/) instead, as it is in active development.

---

<div class="post-metadata">

**Author:** ![JRahm](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/jrahm/32/3327_2.png) [@JRahm](https://community.f5.com/u/JRahm)\
**Post date:** [February 3, 2021, 4:13am UTC](https://community.f5.com/t/trying-to-create-vips-via-python-and-get-an-error/60249/4 "2021-02-03T04:13:41Z")

</div>

Some feedback on your sample:

```tcl
'Protocol' --> Should be:
	'ipProtocol'
 
'vlansEnabled': 'True' --> Should be:
	'vlansEnabled': true
 
 
'icmpecho' --> Should be:
	'icmpEcho'
		BUT
	this is not an attribute on the virtual server, it's on the virtual address (/mgmt/tm/ltm/virtual-address/<ip>), as is the 'arp' attribute
 
'state': 'disabled' --> Should be:
	'enabled': true
		OR
	'disabled': true
 
'port' --> Is included in:
	'destination'
		BUT
	that property is missing, it should include ip:port
 
Make sure profiles is configured appropriately, it is a sub collection
 
'tagMode' is not a property I can find on either virtual server or virtual address, what version are you on?

```

If you want to see the properties on a method, you can use the example by hitting [https://your.bigip.here/mgmt/tm/ltm/virtual/example](https://your.bigip.here/mgmt/tm/ltm/virtual/example). It’s 503 lines long or I’d post it here. Hope this helps.
