Community discussions

MikroTik App
 
netboyzin
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 74
Joined: Thu Mar 21, 2013 3:42 pm

REST API through POSTMAN

Tue Jul 06, 2021 5:28 pm

Hello
Is there any Mikrotik documentation available for REST API integration through POSTMAN ?

Abhishek
 
skocdopolet
just joined
Posts: 2
Joined: Fri Nov 10, 2017 11:40 pm

Re: REST API through POSTMAN

Sun Feb 27, 2022 9:19 pm

I am too interested. Does anybody know about REST API through POSTMAN?
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3253
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: REST API through POSTMAN

Mon Feb 28, 2022 7:35 pm

Postman would be way easier if there was a OpenAPI or swagger schema... Postman can load those which help a ton, since postman can use that to help build collections/tests/etc. There isn't in forum or docs: viewtopic.php?p=859379&hilit=openapi#p859379

Otherwise, you can use postman to build up the requests similar to `curl` and same store/run them from a postman collection manually.

Not sure what you're planing to use postman for, but IMO you should understand variables so you can do stuff like this: "https://{{routerip}}/rest/{{cmd}}" to automate things more if that's your goal with postman.

But the basic steps are hit "New", create a "New HTTP Request", then in the request:
  • set method, default is "GET", but follow Mikrotik's docs if you need PUT or POST on what to select
  • set URL, in basically, the same as the curl examples, e.g. "https://192.168.88.1/rest/ip/address"
  • under "Authentication", set type to be "Basic Auth". *postman UI has more help on how to store this securely...
  • add "Content-Type" as "application/json" under the "Headers" tab of the request part. *without any ";charset=" part!
  • for operations like PUT/PATCH/DELETE methods, use "Body" tab, select "Raw", then use needed the JSON, per Mikrotik's REST docs. *select "JSON" as type, will validate/"beautify" the text if needed.
  • hit "Send" to set, the results are show in the various tabs at the lower half
  • if works as desired, you can use the "Save" button to save it to a collection.
  • and you can run/exit the request in the future from the "Collections" on left.

Beyond that you should look at the Postman docs: https://learning.postman.com/docs/getti ... roduction/
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3253
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: REST API through POSTMAN

Mon Sep 11, 2023 7:55 pm

I created a schema that works with Postman, so the endpoints are pre-populated in a Postman collection. See here:
viewtopic.php?t=199476

Who is online

Users browsing this forum: No registered users and 18 guests