Http API for show

Hi,

i am trying the http api was able to set and delete using the same, how to do show for any command.

also wanted to know if the same is only available with automatic rolling release, as when i tried to compile vyos from git source the same was not getting started.

Regards
senthil

Hi Senthil,
We haven’t included the show operation because the default config format is not at all machine-friendly, and we thought no one will want it. There’s /retrieve endpoint that allows retrieving a single value, like cli-shell-api returnValue

We are planning to add JSON export, and it will be easy to add an option for raw config export when we have it.

1 Like

Hi ,

By when JSON export will be released.

Regards
senthil

@senthil.naidu I’ve added the operation for retrieving raw configs, it will be in tomorrow’s nightly build.

# curl -X POST -F data='{"op": "showConfig", "path": ["interfaces", "dummy"]}' -F key=qwerty http://127.0.0.1:8080/retrieve
{"success": true, "data": " /* So very dummy */\n dummy dum0 {\n     address 192.168.168.1/32\n     address 192.168.168.2/32\n     /* That is a description */\n     description \"Test interface\"\n }\n dummy dum1 {\n     address 203.0.113.76/32\n     address 203.0.113.79/32\n }\n", "error": null}

JSON will take a bit longer, but it definitely will be in the 1.3.0 release.

1 Like

@dmbaturin

Thanks for the update.

Hello,

I’ve got this version image

but i get this issues :

My Command :

curl -X POST -F data=’{“op”: “showConfig”, “path”: [“interfaces”, “dummy”]}’ -F key=**** -k https://192.168.1.16/retrieve

I checked log server : i get a Connection Refused :

VYOS HTTP API CONFIGRUATION :

set service https api keys id REST key ‘****’
set service https api port ‘6443
set service https certificates system-generated-certificate lifetime ‘65535’
set service https listen-address * listen-port ‘6443

When i try with port 6443 :

$ curl -X POST -F data=’{“op”: “showConfig”, “path”: [“interfaces”, “dummy”]}’ -F key=***** -k http://192.168.1.16:6443/retrieve
curl: (7) Failed to connect to 192.168.1.16 port 6443: Connection refused

I reply to myself, i del dummy in data, it works !

But i’ve got a last question where is the documentation about REST API, i didn’t find it !

it not exists (just yet)
but it’s valid point, we need address this gap
@s.lorente want to take care on this and work with @dmbaturin and maybe @Dmitry

1 Like

Yes @syncer . We’ll get that documented.