Community discussions

MikroTik App
 
elico
Member Candidate
Member Candidate
Topic Author
Posts: 143
Joined: Mon Nov 07, 2016 3:23 am

REST API Creating and updating an ip firewall address list with domains

Sun Dec 04, 2022 11:28 pm

Hey,

I am using an external script to dump the DNS cache from the device and then populate an address list with specific domains.
I am able to dump and find the addresses but not sure how to add a batch of domains and/or addresses to the RouterOS device via REST API.
What:
should I use and also, what is the json content that should look like?
For example for "googlevideo" list the next domains:
rr3---sn-jjjpa-ua8e.googlevideo.com
rr3.sn-jjjpa-ua8e.googlevideo.com
rr3.sn-jjjpa-ua8e.googlevideo.com
rr1---sn-aigl6nzs.googlevideo.com
rr1.sn-aigl6nzs.googlevideo.com
rr1.sn-aigl6nzs.googlevideo.com
 
elico
Member Candidate
Member Candidate
Topic Author
Posts: 143
Joined: Mon Nov 07, 2016 3:23 am

Re: REST API Creating and updating an ip firewall address list with domains

Mon Dec 05, 2022 12:09 am

OK so I took the time to write some code and give a programmatically example of an address-list update at:
https://github.com/elico/mikrotik-web-f ... ss-domains

It requires some environment variables like MT_HOST and MT_USER and MT_PASSWORD
I hope it helps someone.
 
elbob2002
Member Candidate
Member Candidate
Posts: 252
Joined: Tue May 15, 2018 8:15 pm
Location: Ireland

Re: REST API Creating and updating an ip firewall address list with domains

Sat Dec 17, 2022 11:51 am

Thanks! I was just looking to do something similar this morning and came across this.

Who is online

Users browsing this forum: No registered users and 17 guests