Community discussions

MikroTik App
 
User avatar
prozak
newbie
Topic Author
Posts: 45
Joined: Sat Jan 16, 2010 4:01 am

Fetch json

Mon Sep 20, 2021 7:56 pm

Hello.
Im trying to fetch from a DSL router the downstream/upstream values in order to dynamically set queues in case of line degradations/variations in speed/profile.

If i hit in my browser http://192.168.0.1/data/Status.json i get the array of the values.
Thing is when i try to fetch it with
/tool fetch mode=http url="http://192.168.0.1/data/Status.json" output=user
i get error
status: failed
action failed (6)
Is this supported by rOS fetch command at all? or am i missing something?
 
msatter
Forum Guru
Forum Guru
Posts: 2897
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Re: Fetch json

Mon Sep 20, 2021 8:02 pm

 
User avatar
prozak
newbie
Topic Author
Posts: 45
Joined: Sat Jan 16, 2010 4:01 am

Re: Fetch json

Mon Sep 20, 2021 8:21 pm

While i included the user agent, it still produces the same error.
Does the webserver of the router require more http headers?
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Fetch json

Mon Sep 20, 2021 8:27 pm

But you must be authenticated on browser to read that file???

Is strange the router leak something without access...

and try the command without "output...." etc.
Simply this:
/tool fetch url="http://192.168.0.1/data/Status.json"
When this work on routeros you can proceed with the next step.
Until this command do not work, all is useless
 
User avatar
prozak
newbie
Topic Author
Posts: 45
Joined: Sat Jan 16, 2010 4:01 am

Re: Fetch json

Mon Sep 20, 2021 8:33 pm

I know that the command in terminal should produce output.
And yes router does not need auth to display this info :lol: its by design so you can get DSL rates without having logging in.
Call it ease of access.
thing is I still dont understand whats missing and it breaks
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Fetch json

Mon Sep 20, 2021 8:50 pm

I know that the command in terminal should produce output.
You do not have understand, do not use output=something for now...

The Router what IP have?
Is in the same lan?
have more than one ip?
get the ip from dhcp server on the DSL router or have fixed IP?
the DSL router reply only to device that have get the IP from DHCP or have the IP on DSL router pool?
obviously without any /export and without network schema, are only conjectures

replace the 192.168.0.2 with the IP of routeros device
/tool fetch url="http://192.168.0.1/data/Status.json" src-address=192.168.0.2
if do one error, put the result on forum
 
User avatar
prozak
newbie
Topic Author
Posts: 45
Joined: Sat Jan 16, 2010 4:01 am

Re: Fetch json

Mon Sep 20, 2021 10:22 pm

Its not an issue of ip / pool address. i hit the dsl router's webpage through mikrotik gateway normally.
still same failed result with extra src-address
 
User avatar
frank333
Member
Member
Posts: 328
Joined: Mon Dec 18, 2017 12:17 pm
Location: S.Marino Router model: RB3011UiAS-RM+RBM11G

Re: Fetch json

Sun Sep 26, 2021 10:39 am

I have the same problems as you, i.e. the command from the browser works, while via script it doesn't work I think it's a syntax problem and I can't find any information.

Who is online

Users browsing this forum: ko00000000001 and 21 guests