I try to create my own API in vb.net language
I have used this code to disable users in hotspot, but didn't work
Code: Select all
mikrotik.Send("/ip/hotspot/user/set/=.name=user1=disabled=yes", True)
thanks
mikrotik.Send("/ip/hotspot/user/set/=.name=user1=disabled=yes", True)
thanks for replay ,
mikrotik.Send("/ip/hotspot/user/print", True)
mikrotik.Send("=.proplist=.id", True)
mikrotik.Send("?comment=teste", True)
thank you so much for your helpnot '=.proplist', but '.proplist'
!trap=message=no such command prefix!done
mikrotik.Send("?name=user1", False)
and what if justmessage=no such command prefix
mikrotik.Send("/ip/hotspot/user/print", False)
I have used the search by name and comment and all of them do not work .by the way, last line should be not 'mikrotik.Send("?comment=teste", True)' but 'mikrotik.Send("?comment=teste", False)'
and for you it should beCode: Select allmikrotik.Send("?name=user1", False)
if i use just this code , it bring my customer data without disable any account .and what if justmessage=no such command prefix?..Code: Select allmikrotik.Send("/ip/hotspot/user/print", False)
mikrotik.Send("=.id=*4EB", True)
ok , this is the complete codefirst, re-read the posts at that topic. you should do what you want in two steps. "=.id=*4EB" is .id, obtained from the first step
secont, what version of ROS do you use? queries (like '?comment=something') can be used since v3.21
mikrotik.Send("/ip/hotspot/user/print", False)
mikrotik.Send("=.proplist=.id", False)
mikrotik.Send("?name=user1", False)
For Each h As String In mikrotik.Read()
TextBox1.Text &= h
Next
mikrotik.Send("/ip/hotspot/user/set", False)
mikrotik.Send("=.id=h", False)
mikrotik.Send("=disabled=yes", False)
mikrotik.Send("/ip/hotspot/user/print", False)
mikrotik.Send("=.proplist=.id", False)
mikrotik.Send("?name=user1", False)
mikrotik.Send("/ip/hotspot/user/print", True)
mikrotik.Send("=.proplist=.id", True)
mikrotik.Send("?name=user1", False)
ok , what can i do to make it one command not three ?notbutCode: Select allmikrotik.Send("/ip/hotspot/user/print", False) mikrotik.Send("=.proplist=.id", False) mikrotik.Send("?name=user1", False)
- it's one command, not three commandsCode: Select allmikrotik.Send("/ip/hotspot/user/print", True) mikrotik.Send("=.proplist=.id", True) mikrotik.Send("?name=user1", False)
so, what does it return?
mikrotik.Send("/ip/hotspot/user/print", True), ("=.proplist=.id", True),("?name=user1", False)
ok , what can i do to make it one command not three ?
Code: Select allmikrotik.Send("/ip/hotspot/user/print", True) mikrotik.Send("=.proplist=.id", True) mikrotik.Send("?name=user1", False)
please quote exact code and exact responsethe above code return the same message !
sorry for disturbing youplease quote exact code and exact response
mikrotik.Send("/ip/hotspot/user/print", True)
mikrotik.Send("=.proplist=.id", True)
mikrotik.Send("?name=user1", False)
finally I made itwhat programming language do you use?..
try removing second or third lines - see whether result changes (and don't forget about second argument, only in last line it should be False)
mikrotik.Send("/ip/hotspot/user/set")
mikrotik.Send("=disabled=yes")
mikrotik.Send("=.id=user1", True)
to make things clearer for other, what i quoted is one command with arguments you send to RouterOS through API. This example is in one specific implementation of API, without that wrapper:Code: Select allmikrotik.Send("/ip/hotspot/user/set") mikrotik.Send("=disabled=yes") mikrotik.Send("=.id=user1", True)
and use .id value not name, to address entry, as that is unique number that is assigned to that entry and wont change over time./ip/hotspot/user/set
=disabled=yes
=.id=user1
omg! it's working! so, in .id, you can send not only unique id of the item, but also the name!=.id=user1