30-Jan-2023 02:32
Good day,
We are looking at using POSTMAN to "script" pool creations.
I am able to submit one pool at a time to the device but when I attempt multiple pools it fails with a 400 error.
Sample:
30-Jan-2023 02:49 - edited 30-Jan-2023 03:01
those are 2 json objects.
It should be one so you need to put those 2 in a list of dictionaries, something like this:
[
{
"name":"x10779",
"partition":"x",
"loadBalancingMode":"least-connections-node",
"monitor":"/Common/tcp",
"members":[
{"name":"x.x.x.x:10779"}
]
}
,
{
"name":"x10778",
"partition":"x",
"loadBalancingMode":"least-connections-node",
"monitor":"/Common/tcp",
"members":[
{"name":"x.x.x.x:10778"}
]
}
]
30-Jan-2023 03:59 - edited 30-Jan-2023 04:00
Hi
Thanks for the feedback, however still no luck.
30-Jan-2023 05:51 - edited 30-Jan-2023 06:25
I don't know about Postman but it would be easier to use python or Ansible for this.
There is a way to add a data file ( where you have a list of json dictionaries) to Postman and get data from it but it did not work for me for some reason.
01-Feb-2023 00:23 - edited 01-Feb-2023 00:30
I've managed to create pools via Postman. You will need to a collection and under it the post request.
Then you need a file containing your configuration of the pools, under your user ~/Postman/files/ folder.
here is an example of a file:
[
{
"name": "pool1",
"loadBalancingMode": "least-connections-node",
"monitor": "/Common/tcp",
"members": [
{
"name": "8.8.8.8:10779"
} ,
{
"name": "1.1.1.1:80"
}
]
},
{
"name": "pool2",
"loadBalancingMode": "round-robin",
"monitor": "/Common/tcp",
"members": [
{
"name": "9.9.9.9:10779"
},
{
"name": "2.2.2.2:443"
}
]
}
]
You also need to put this under the Pre-request Script:
pm.variables.set(`requestBody`, JSON.stringify(pm.iterationData.toObject()))
Under the body, select raw and JSON type and put this:
{{requestBody}}
Then you have to run the Collection and select the above file.
And that's it.
I've also created a collection for creating a VIP.