Community discussions

MikroTik App
 
blingblouw
Member
Member
Topic Author
Posts: 345
Joined: Wed Aug 25, 2010 9:43 am

REST

Tue Dec 08, 2020 11:30 am

Not sure if this has been spoken about already but this is going to be huge for us!

https://help.mikrotik.com/docs/display/ROS/REST+API
 
amorsen
newbie
Posts: 37
Joined: Wed Jun 13, 2007 2:17 pm

Re: REST

Wed Dec 16, 2020 1:13 pm

That looks amazing!

It would be even better if there was a safe-mode for the API, to recover from mistakes that block access.
 
pe1chl
Forum Guru
Forum Guru
Posts: 10183
Joined: Mon Jun 08, 2015 12:09 pm

Re: REST

Wed Dec 16, 2020 1:59 pm

That would be difficult in a single-shot API like REST... but it is possible in the original API that is based on a session.
 
User avatar
pants6000
Frequent Visitor
Frequent Visitor
Posts: 86
Joined: Fri Sep 26, 2014 5:30 am

Re: REST

Wed Dec 16, 2020 6:03 pm

Is this V7 only? Backporting this to V6 would be pretty nice if so...
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26287
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: REST

Thu Dec 17, 2020 9:39 am

Backporting anything to v6 makes v6 just as unstable as v7, so what is the use? Just use v7 then
 
pe1chl
Forum Guru
Forum Guru
Posts: 10183
Joined: Mon Jun 08, 2015 12:09 pm

Re: REST

Thu Dec 17, 2020 11:46 am

When that new documentation system was introduced I already questioned if it would not have been better to have a documentation system where you can anchor pages to a certain version, so you can input a version number somewhere and you get the documentation as it is relevant to that version. Or at least have different documentation for the long-term, stable, testing and development versions (that gets migrated once those versions change status).
It does not appear this system supports that. But at least there could be a paragraph on every page with "introduced in version x.xx" or similar.
As it is now, nowhere on that page it says that this is a version 7 feature.
 
r00t
Long time Member
Long time Member
Posts: 672
Joined: Tue Nov 28, 2017 2:14 am

Re: REST

Thu Dec 17, 2020 3:10 pm

pe1chl: Completely agree. At minimum, there should be a first paragraph on every page listing versions of ROS each page is relevant to. With big differences between 6.x and 7.x it's quite important to know. But also for features added to 6.x there should always be note of minimum ROS version, differences between long-term and stable are often quite big.
 
mada3k
Long time Member
Long time Member
Posts: 682
Joined: Mon Jul 13, 2015 10:53 am
Location: Sweden

Re: REST

Sun Dec 20, 2020 12:04 pm

Amazing.

We have done a lot of automation with Ansible and SSH, but this will for sure be next level.
 
Elim
just joined
Posts: 1
Joined: Fri Dec 25, 2020 2:49 am

Re: REST

Fri Dec 25, 2020 3:08 am

I don't wanna start new thread 'cause it's probably my mistake somewhere but I've tried to, well, try new REST API and long story short I failed. I'm having a 7.1beta3 version of routerOS, enabled ip/service/api (in default), api-ssl (in default but added certificate "mtapi", about it later, and listen on 0.0.0.0/0), www-ssl (in default but added certificate "mtapi", same as in api-ssl) the "others" are in default untouched. Certificate seems to work fine and i have no issue with it i.e. www-ssl works with that certificate so API should too but it's not. While sole service may not be working properly port 8729 works and it answers i.e. at first connection it prompts the warning about unsafe connection with unknown certificate. Problem is I get no answer I'm just put on hold, no timeout no unauthorized, nothing. I did what was said in https://help.mikrotik.com/docs/display/ROS/REST+API but with no effect. Did someone here who made it work on their's rOS can write requisites what needs to be really done to make it work?
 
flameproof
Member Candidate
Member Candidate
Posts: 128
Joined: Tue Sep 01, 2015 3:17 pm

Re: REST

Thu Dec 31, 2020 12:33 pm

Is this available on v7.1beta3? The document literally states from "RouterOS v7beta4", but that could be read as "v7.0beta4"?

In any case, I have found two issues:

- Crash when using certain SSL certificates which work fine on v6 (1000s of units deployed). I can file a report if it helps. When this cert is used for www-ssl, any form of SSL access to the device results in:

0	Jan/02/1970 01:00:13	memory	system, error, critical	router was rebooted without proper shutdown	
1	Jan/02/1970 01:00:14	memory	system, error, critical	kernel failure in previous boot	
2	Jan/02/1970 01:00:14	memory	system, error, critical	out of memory condition was detected

- Nothing is available when calling the REST API URLs. For example, https://<IP_OF_RB>/rest/system/resource or /ip/address results in:

HTTP/1.1 404 Not Found
Cache-Control: no-store
Connection: close
Content-Length: 109
Date: Fri, 02 Jan 1970 00:18:47 GMT
Expires: 0
Pragma: no-cache

<html>
<head><title>Error 404: Not Found</title></head>
<body>
<h1>Error 404: Not Found</h1>
</body>
</html>

A POST instead of GET results in:

<html>
<head><title>Error 501: Not Implemented</title></head>
<body>
<h1>Error 501: Not Implemented</h1>
</body>
</html>
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7038
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: REST

Sat Jan 02, 2021 4:00 pm

The REST API will be available when we release v7.1beta4.
 
pe1chl
Forum Guru
Forum Guru
Posts: 10183
Joined: Mon Jun 08, 2015 12:09 pm

Re: REST

Sat Jan 02, 2021 8:01 pm

Even now, the documentation page is not formally correct.
It says "Starting from RouterOS v7.1beta4, it is implemented as a JSON wrapper interface of the console API." (with bold added after comments here)
But that tells nothing about what versions it is available in. It could be read as "the implementation has changed in that version, before it was a standalone service".

I think (like r00t) that when the documentation system is unable to handle different pages per RouterOS version (i.e. version control integrated in the system), a standard section has to be included in each page (at the top or bottom, whatever is convenient) with a "available from version Vx.xx" and if applicable "until version Vx.xx".
And, when important changes are made (like new capabilities of an existing service) probably also a notice within the text.

For example, OpenVPN is mentioned to use TCP or UDP, but the UDP capability is only available in V7. But that is not mentioned on the page.
Of course when there are lots of tags like that the whole thing becomes unreadable, that is why it would be much better to have a version selection at the top and then show only the doc relevant for that version down below that.

Who is online

Users browsing this forum: No registered users and 22 guests