- Working on a script to upload a CLI template to Prime, followed by deployment.
- As part of my script need to have multiple variables used:
- /webacs/api/v1/op/cliTemplateConfiguration/upload
...
"variables" :
{"variable" : {
"defaultValue" : "",
"description" : "IP address",
"displayLabel" : "",
"name" : "RemoteClient",
"rangeFrom" : "",
"rangeTo" : "",
"required" : True,
"type" : "IPv4 Address",
"validationExpression" : ""
},
"variable" : {
"defaultValue" : "",
"description" : "VLAN number",
"displayLabel" : "",
"name" : "VlanId",
"rangeFrom" : "",
"rangeTo" : "",
"required" : True,
"type" : "Integer",
"validationExpression" : ""
}
}
---
- Able to send one variable to Prime, but not more. The documentation asks for a list of variables. It does not seem to work as a list of variables.
- The documentation is not very clear how to actually accomplish this. How to format the data needed to send to be able to use multiple variables in the code.
So for JSON, there should be a JSON object "variables" containing a JSON array "variable" of variable objects.
"variables":{ "variable":[ {"name":"Example one","description":"Example",...}, {"name":"Example two","description":"Example",...}, {"name":"Example three","description":"Example",...} ] }
The square brackets denote that it's an array of objects.
For customers using JSON, we recommend moving to API v2, as the JSON output and input handling for arrays is consistent (in v1, the JSON handler will treat "variable" as an object if it has only one element and an array if it has more than one).
It worked as stated. Example of using two variables: $VlanId and $RemoteClient
list_var = { 'variable': [ {'name': 'RemoteClient', 'displayLabel': 'RemoteClient', 'description': 'IP address', 'required': 'True', 'type': 'IPv4 Address'}, {'name': 'VlanId', 'displayLabel': 'VlanId', 'description': 'VLAN number', 'required': 'True', 'type': 'Integer'} ] }
Comments
0 comments
Please sign in to leave a comment.