WordPress API Mikrotik

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?

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?

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.

Normis, from what you write it seems like you don’t really like Wordpress

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.

Tech. pros don’t like WordPress :wink:

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

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.