[API suggestion] Type indicator word
Posted: Tue Sep 06, 2011 10:53 pm
First stop, sorry if this is not the way to actually make feature requests. I'd resend this to the appropriate place if I must. I simply don't see another way to do so (beyond the support email...).
It would be nice if the API could in some fashion return type information for the current reply. This would make creation of type aware clients easier, which would in turn make work with such clients easier.
Right now, clients need to either read everything as a string, or embed in themselves "knowledge" about the types of the arguments in each section. Having that knowledge would force them to keep up with RouterOS though, which would make clients fragile (or would limit MikroTik in their work due to desire to keep clients compatible... both scenarios are bad for the end user).
I propose a new API word that would carry type information. The exact format of the word is irrelevant, although I do have one in mind, specified below.
For example, let's say we do
Each reply is currently something like
With the proposed word, it would look something like:
The API word is called "argumentTypes", and after it there is a space separated list of name=value pairs. The name of the property, and its scripting type as the value. Note that in the case of arrays, if RouterOS knows the types within the array, it shoud fill them too (in this case surrounded with "[]").
It would be nice if the API could in some fashion return type information for the current reply. This would make creation of type aware clients easier, which would in turn make work with such clients easier.
Right now, clients need to either read everything as a string, or embed in themselves "knowledge" about the types of the arguments in each section. Having that knowledge would force them to keep up with RouterOS though, which would make clients fragile (or would limit MikroTik in their work due to desire to keep clients compatible... both scenarios are bad for the end user).
I propose a new API word that would carry type information. The exact format of the word is irrelevant, although I do have one in mind, specified below.
For example, let's say we do
Code: Select all
/queue/simple/print
=.proplist=.id,name,disabled,dst-address,target-addresses,priority
Code: Select all
!re
=.id=*1
=name=queue1
=disabled=no
=dst-address=192.168.10.1
=target-addresses=192.168.0.100,192.168.0.1
=priority=8
Code: Select all
!re
=.id=*1
=name=queue1
=disabled=no
=dst-address=192.168.10.1
=target-addresses=192.168.0.100,192.168.0.1
=priority=8
.argumentTypes .id=ID name=string disabled=boolean dst-address=IP target-addresses=array[IP] priority=number