Community discussions

MikroTik App
 
abbio90
Member Candidate
Member Candidate
Topic Author
Posts: 207
Joined: Fri Aug 27, 2021 9:16 pm
Contact:

WordPress API Mikrotik

Mon Jan 22, 2024 9:57 am

good morning everyone, I would like to integrate some variables taken from the various Mikrotik routers into a Word Press site accessible only with login. Reading other discussions in the forum it seems that it is necessary to start an API client. What would? can I find it in the WordPress plugins? or is it an application to be built from scratch?
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26387
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: WordPress API Mikrotik

Mon Jan 22, 2024 10:04 am

Yes but Why?

Wordpress has plugins that allow to connect to other site REST API: https://wordpress.org/plugins/wpgetapi/
And in RouterOS you can enable REST API: https://help.mikrotik.com/docs/display/ROS/REST+API

But why wordpress?
 
abbio90
Member Candidate
Member Candidate
Topic Author
Posts: 207
Joined: Fri Aug 27, 2021 9:16 pm
Contact:

Re: WordPress API Mikrotik

Mon Jan 22, 2024 10:13 am

the site is already currently active on CMS WordPress. I would like every user to be able to see their routers online from the site and see some statistics.
 
abbio90
Member Candidate
Member Candidate
Topic Author
Posts: 207
Joined: Fri Aug 27, 2021 9:16 pm
Contact:

Re: WordPress API Mikrotik

Mon Jan 22, 2024 10:14 am

Normis, from what you write it seems like you don't really like Wordpress
 
abbio90
Member Candidate
Member Candidate
Topic Author
Posts: 207
Joined: Fri Aug 27, 2021 9:16 pm
Contact:

Re: WordPress API Mikrotik

Sat Jan 27, 2024 3:18 pm

Wordpress has plugins that allow to connect to other site REST API: https://wordpress.org/plugins/wpgetapi/
I managed to use the indicated widget, however I find that the command http://ip/rest/ip/address?interface=ether1 does not work as the plugin adds an & after the link, returning an empty output.
 
User avatar
memelchenkov
Member Candidate
Member Candidate
Posts: 202
Joined: Sun Oct 11, 2020 12:00 pm
Contact:

Re: WordPress API Mikrotik

Sat Jan 27, 2024 4:11 pm

Normis, from what you write it seems like you don't really like Wordpress
Tech. pros don't like WordPress ;-)
 
abbio90
Member Candidate
Member Candidate
Topic Author
Posts: 207
Joined: Fri Aug 27, 2021 9:16 pm
Contact:

Re: WordPress API Mikrotik

Sun Jan 28, 2024 11:25 am

I understand that the Wordpress CMS is not used for sites of a certain size. In any case, mine is a blog and for now I'm happy with it. If the site takes off, I will consider changing CMS. Let's go back to the TOPIC. I managed to read all the functions of the mikrotik with PHP and curl scripts. now I would like to understand how to write or launch scripts with curl. could anyone give me a hand? There are no examples related to the script in the wiki
 
User avatar
Nullcaller
Member Candidate
Member Candidate
Posts: 122
Joined: Mon Oct 16, 2023 3:09 pm

Re: WordPress API Mikrotik

Sun Jan 28, 2024 11:42 am

I managed to read all the functions of the mikrotik with PHP and curl scripts. now I would like to understand how to write or launch scripts with curl. could anyone give me a hand? There are no examples related to the script in the wiki

Wiki gives you all the information you need on MikroTik's REST API (it's just terminal commands-turn-JSON). You should, provided you have some knowledge of PHP, be able to turn that into a WordPress plugin/bodge.

I would advise against it, since, if you create a single vulnerability while writing this plugin/bodge, which you inevitably will (you're asking for help writing basic PHP things, and PHP is not beginner-friendly in terms of writing secure code), you're giving a potential attacker control of or knowledge about your network.

Also, note that your site being able to access your visitors' routers would necessitate them opening up REST API access on their routers to the Internet, which I think no sane person would ever do.

Who is online

Users browsing this forum: No registered users and 10 guests