Page 1 of 1

Upload file with fetch on mode http

Posted: Wed Apr 12, 2017 4:45 am
by jamecollins
I have try upload file with fetch on mode ftp, that okay. But how can I upload file with http mode? Thanks for your support.

Re: Upload file with fetch on mode http

Posted: Wed Apr 12, 2017 12:42 pm
by normis
How would that work exactly?

Re: Upload file with fetch on mode http

Posted: Thu Apr 13, 2017 4:24 am
by jamecollins
How would that work exactly?
Thanks for your reply. I want upload file to my server via http, not by ftp protocol. And one more question about checking result of upload file. I follow this method but this not work. viewtopic.php?t=114626
Thanks

Re: Upload file with fetch on mode http

Posted: Thu Apr 13, 2017 9:51 am
by normis
how does the server support this? are you talking about an upload FORM element, or some HTTP POST request or what? You can't just upload files to any server. There has to be some specific method the server is expecting, and you must know which one.

Re: Upload file with fetch on mode http

Posted: Fri Apr 14, 2017 4:19 am
by jamecollins
how does the server support this? are you talking about an upload FORM element, or some HTTP POST request or what? You can't just upload files to any server. There has to be some specific method the server is expecting, and you must know which one.
Thanks for your reply. Yes I want upload file via HTTP POST request.

Re: Upload file with fetch on mode http

Posted: Fri May 26, 2017 5:50 am
by MSapogov
Hello!
RouteOS 6.39.1
I need upload XML file to my Hikvision ip camera from mikrotik.
/tool fetch url="http://admin:12345@192.168.11.51:80/Video/inputs/channels/1/overlays/text" http-method=post http-data="new.xml"
mikrotic responce:
[admin@Bee-GW] > /tool fetch url="http://admin:12345@192.168.11.51:80/Video/inputs/channels/1/overlays/text" http-method=post http-data="new.xml"     
  status: failed

failure: closing connection: <400 Bad Request> 192.168.11.51:80 (4)
new.xml :
<?xml version="1.0" encoding="UTF-8"?>
<TextOverlayList version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema">
<TextOverlay>
<id>1</id>
<enabled>true</enabled>
<posX>16</posX>
<posY>32</posY>
<message>Test !</message>
</TextOverlay>
</TextOverlayList>
From linux machine - is OK
curl -T new.xml http://admin:12345@192.168.11.51:80/Video/inputs/channels/1/overlays/text
linux responce:
root@Bee-WWW:/home/script/ipcamera/temp# curl -T new.xml http://admin:12345@192.168.11.51/Video/inputs/channels/1/overlays/text

<?xml version="1.0" encoding="UTF-8"?>
<ResponseStatus version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema">
<requestURL>/Video/inputs/channels/1/overlays/text</requestURL>
<statusCode>1</statusCode>
<statusString>OK</statusString>
</ResponseStatus>

Re: Upload file with fetch on mode http

Posted: Thu Aug 08, 2019 5:28 pm
by eehan
Did you guys work this out? FYI, I have worked out how to control the Hikvision by the XML API from Mikrotik script - let me know if you are interested.

Re: Upload file with fetch on mode http

Posted: Wed Sep 25, 2019 1:55 pm
by NetVicious
http-data parameter of /tool fetch it's only used to set which string will be sent to the server when doing one upload.

It doesn't work (at this moment with RouterOS 6.45.6) in the way you're trying to do writing the name of the file you want to upload on the http-data parameter.

You should use the ftp mode of the fetch tool.

Re: Upload file with fetch on mode http

Posted: Tue Dec 29, 2020 11:38 am
by mstsc
Did you guys work this out? FYI, I have worked out how to control the Hikvision by the XML API from Mikrotik script - let me know if you are interested.
Please tell us how you did it.