Hi everyone.
I try to send file in telegram chat, but get: “failure: closing connection: <400 Bad Request>”
{ :local photo [/file find name="123.png"];
/tool fetch http-method=post url="https://api.telegram.org/botXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXX/sendDocument\?chat_id=XXXXXXXXX&document=$photo";
}
When I send message, it works.
/tool fetch url="https://api.telegram.org/botXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXX/sendmessage\?chat_id=XXXXXXXXX&text=test"
The default content-type is: content-type = application / x-www-form-urlencoded and can not be changed.
Unfortunately, we can send files only this way
/tool fetch url="https://api.telegram.org/botXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXX/sendDocument\?chat_id=XXXXXXXXX" http-method=post http-data="document=http://test.ru/test.jpg" keep-result=no;
jspool
3
Have you looked closely at: http://forum.mikrotik.com/t/post-request-with-fetch/108061/12
http://forum.mikrotik.com/t/post-request-with-fetch/108061/12
https://www.iana.org/assignments/media-types/media-types.xhtml
http://www.freeformatter.com/mime-types-list.html