Community discussions

MikroTik App
 
KautIM
just joined
Topic Author
Posts: 1
Joined: Tue Nov 22, 2022 3:58 pm

Can't post request ptopperly with fetch tool

Tue Nov 22, 2022 4:12 pm

Hello everyone,

I have been trying to make a script to restart my FRITZ-Box internet router with the Mikrotik Router, but for some reason I keep facing an error that i can not work around.
I've recreated this same script in Powershell and it has worked without a flaw, but for some reason the same can not be said for the mikrotik router.

Here is the request im sending VIA Mikrotik:
/tool fetch http-method=post http-header-field="Content-Type: text/xml; charset='utf-8',SoapAction: urn:dslforum-org:service:DeviceConfig:1#Reboot" user="user" password="pass" url="http://blabla" http-data="<?xml version='1.0' encoding='utf-8'?><s:Envelope s:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'><s:Body><u:Reboot xmlns:u='urn:dslforum-org:service:DeviceConfig:1'></u:Reboot></s:Body></s:Envelope>"
I have used a request catcher to see the diffrences between the powershell and the Mikrotik post request, here is what those look like:

MIKROTIK:
POST / HTTP/1.1
Host: xxx.requestcatcher.com
Connection: close
Authorization: Basic ZnJpdHo5ODIxOkthdXRlbmJ1cmdlciM=
Connection: close
Content-Length: 263
Content-Type: text/xml; charset='utf-8'
Content-Type: application/x-www-form-urlencoded
Soapaction: urn:dslforum-org:service:DeviceConfig:1#Reboot
User-Agent: Mikrotik/6.x Fetch

<?xml version='1.0' encoding='utf-8'?><s:Envelope s:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'><s:Body><u:Reboot xmlns:u='urn:dslforum-org:service:DeviceConfig:1'></u:Reboot></s:Body></s:Envelope>
POWERSHELL:
POST / HTTP/1.1
Host: xxx.requestcatcher.com
Content-Length: 263
Content-Type: text/xml; charset='utf-8'
Soapaction: urn:dslforum-org:service:DeviceConfig:1#Reboot
User-Agent: Mozilla/5.0 (Windows NT 10.0; Microsoft Windows 10.0.19044; de-IT) PowerShell/7.3.0

<?xml version='1.0' encoding='utf-8'?><s:Envelope s:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'><s:Body><u:Reboot xmlns:u='urn:dslforum-org:service:DeviceConfig:1'></u:Reboot></s:Body></s:Envelope>
Any help is apreciated :)
 
serkamil
just joined
Posts: 7
Joined: Wed Jun 01, 2016 5:25 pm

Re: Can't post request ptopperly with fetch tool

Thu Nov 30, 2023 10:09 am

Dear KautIM,

did you find the solution for this problem?

I have something similar and worry me the "Connection: close" value.

I try to change REST API value by fetch tool and it working fine with (Linux) curl tool but not with (Mikrotik) fetch tool.

The most intereting different is with this Connection value.

Best regards,
Kamil

Who is online

Users browsing this forum: Ahrefs [Bot] and 15 guests