Quantcast
Channel: MikroTik
Viewing all articles
Browse latest Browse all 15172

Scripting • Re: How using .query stack in REST API?

$
0
0
I have an example here: viewtopic.php?t=198974#p1021503
e.g.
Code:
USER=admin ROUTER=192.168.88.1; curl -l -u $USER -X POST http://$ROUTER/rest/ip/firewall/nat/print -H "Content-Type: application/json" --data '{".query": ["chain=dstnat","chain=srcnat","#|!"]}' 
It's tricky with .query in JSON. The comparison operators are all "stack based" (like an old HP RPN calculator). But AFAIK all operators should be at end of the array, working down the stack.

How .query work is semi-described in API docs as it follows Mikrotik older/non-HTTP API: https://help.mikrotik.com/docs/display/ ... PI-Queries – but seems you figured out that part.

Statistics: Posted by Amm0 — Fri Feb 02, 2024 4:48 am



Viewing all articles
Browse latest Browse all 15172

Trending Articles