Community discussions

MikroTik App
 
sash
just joined
Topic Author
Posts: 1
Joined: Thu Oct 26, 2023 6:09 pm

Change the VLAN ID via REST API using the interface name

Thu Oct 26, 2023 6:24 pm

Hi. I need to change port VLAN id via REST API.

First of all I get information about ports
Request:
POST /rest/interface/bridge/port/print HTTP/1.1
{".proplist" : [".id","interface","pvid"]}

Response:
[{".id":"*0","interface":"ether2","pvid":"500"},{".id":"*1","interface":"ether3","pvid":"501"},{".id":"*2","interface":"ether4","pvid":"1"},{".id":"*3","interface":"ether1","pvid":"501"}]

And try to change `pvid` on `ether1`
Request:
PATCH /rest/interface/bridge/port/*3 HTTP/1.1
{"pvid" :"505"}

Response:
{".id":"*3", ..., "interface":"ether1", ... "pvid":"505"}
of course it works well, but I need to use port `{id}`.


In Winbox I can exec command without `{id}`, using `find`
/interface/bridge/port/set [find where interface=ether1] pvid=505

Is there REST request without specifying an ID? For example
PATCH /rest/interface/bridge/port/?interface=ether1 HTTP/1.1
{"pvid" :"505"}

Who is online

Users browsing this forum: Seekport [Bot] and 8 guests