VyOS API: JSON equivalent for Form data?

Hi is there a working JSON structure equivalent to the following form data call?:

curl -k --location --request POST ‘[https://172.16.1.2/configure’]

–form data=‘[{“op”: “set”,“path”:[“policy”, “prefix-list”, “NYC_EXPORT”, “rule” , “20”, “prefix”, “10.0.0.0/32”]}, {“op”: “set”,“path”:[“policy”, “prefix-list”, “NYC_EXPORT”, “rule” , “20”, “action”, “permit”]}]’
–form key=‘123456’

The general form is:
curl -k -X POST -d ‘{“key”: key-value-string, “commands”: [{command1}, …, {commandN}]}’ https://example.net/configure
So in your case:
curl -k -X POST -d ‘{“key”: “123456”, [{“op”: “set”,“path”:[“policy”, “prefix-list”, “NYC_EXPORT”, “rule” , “20”, “prefix”, “10.0.0.0/32”]}, {“op”: “set”,“path”:[“policy”, “prefix-list”, “NYC_EXPORT”, “rule” , “20”, “action”, “permit”]}]}’ https://172.16.1.2/configure

OpenAPI docs can be viewed, in your case, at https://172.16.1.2/redoc, where, under ‘ConfigureOp’, select the ‘ConfigureListModel’.

1 Like