hi.
i want to use fetch via api. problem is that trough api running fetch repeats its status on and on forever until it gets terminated by ‘/cancel’. it makes things difficult. it requires someone (like me) to implement totally different method to use ‘/tool fetch’ in mikrotik via api. it is not compatible with api standard and error raising.
sample how it looks when succedded to download.
<<< /tool/fetch
<<< =url=http://ftp.pl.debian.org/debian/README
<<<
>>> !re
>>> =status=connecting
>>>
>>> !re
>>> =status=finished
>>>
>>> !re
>>> =status=finished
>>>
>>> !re
>>> =status=finished
>>>
>>> !re
>>> =status=finished
>>>
/cancel
<<< /cancel
<<<
>>> !trap
>>> =category=2
>>> =message=interrupted
>>>
>>> !done
>>>
>>> !done
>>>
sample when it failed to download
<<< /tool/fetch
<<< =url=http://wp.pl/100
<<<
>>> !re
>>> =status=connecting
>>>
>>> !re
>>> =status=failed
>>>
>>> !re
>>> =status=failed
>>>
>>> !re
>>> =status=failed
>>>
>>> !re
>>> =status=failed
>>>
>>> !re
>>> =status=failed
>>>
/cancel
<<< /cancel
<<<
>>> !trap
>>> =category=2
>>> =message=interrupted
>>>
>>> !done
>>>
>>> !trap
>>> =message=failure: 301 Moved Permanently
>>>
>>> !done
>>>
as you can see in both cases ‘/cancel’ is necesary.
what I (as a developer) would like to see:
when fetch is launched do not throw any information. just wait as long as transfering
when downloading/uploading finishes:
- end it with ‘!done’ in case of success. return .id of new file when downloading
- end it with ‘!trap’ in case of failure and add =msg=DETAILED MESSAGE WHAT HAVE HAPPENED
this would nicelly follow api concepts and will ease ‘cathing exceptions’. it will ease any programmers work without any spagetti code.
mikrotik developers please look into it becuse some of us really would like to see it working without any ‘dirty hacks’.
this was also discussed in:
http://forum.mikrotik.com/t/solved-php-api-terminating-the-tool-fetch-command/51788/1
http://forum.mikrotik.com/t/api-php-class/22551/1