Community discussions

MikroTik App
 
mikeghosty
just joined
Topic Author
Posts: 7
Joined: Sun Jul 21, 2019 8:40 pm

Function Request

Mon Jul 19, 2021 6:36 pm

Hi,

I'm looking to create a function to reture a value from an HTTP Get comand. or HTTP Head comand.

Currently
Will return an integer however in order to get it into the device appearance i need it in a function. How do i go about this?


m
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Function Request

Mon Jul 19, 2021 8:18 pm

Search the forum, already explained with examples how to save the "get" from fetch to file and after that read the file content as value.
 
mikeghosty
just joined
Topic Author
Posts: 7
Joined: Sun Jul 21, 2019 8:40 pm

Re: Function Request

Mon Jul 19, 2021 9:38 pm

Search the forum, already explained with examples how to save the "get" from fetch to file and after that read the file content as value.
Thanks Rextended,

I've been searching and searching for examples but i haven't found anything helpful. Maybe i'm searching for the wrong thing. I'll have another go using what you've put but if you have any pointers that would be great.

m
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Function Request

Mon Jul 19, 2021 11:50 pm

https://wiki.mikrotik.com/wiki/Manual:T ... a_variable

I literally wrote you what needs to be done, and let you think, rather than just copy & paste...
:put  ([/tool fetch url="http://x.x.x.x/devices/statistics/online-count" as-value output=user]->"data")

Who is online

Users browsing this forum: No registered users and 6 guests