V7.1.3 Rest API is it possible to add multiple values in a single request?

I have been working with V7 rest API for quite some time and it’s wonderful.
In bash I am running the next request:
curl -s -k -u “${USERNAME}:${PASSWORD}” -X POST “https://${HOST}/rest/ip/firewall/address-list/add”
–data “{"address":"${ADDRESS}","list":"YOUTUBE_DOMAINS"}” -H “content-type: application/json”

which is great however I need to add into the address list more then one address at a time.
I have about 1k of these so I was wondering if someone knows if there is a better way to add all of them in a single request.
I have tried to read the docs at:
https://help.mikrotik.com/docs/display/ROS/REST+API
couple times but have yet to find the right way to do so.

API is the same as CLI, you can add only one entry by one “add” command.

What about the PUT command?
Can I add multiple values in a single command?
ie how would I add multiple values with the next curl command? what json content will add more then one entry per request?
Currently I am running a script that re-creates the whole list every 30 minutes, it would help me to run a single curl/other command that will replace this script.

curl -s -k -u "${USERNAME}:${PASSWORD}" -X PUT "https://${ROUTEROS_ADDRESS}/rest/ip/firewall/address-list" \
  --data " { \"address\": \"1.1.1.1\" ,\"list\":\"IL\"}" \
  -H "content-type: application/json"

You can call curl twice. That okay, the 2nd one doesn’t replace the first value. Additional PUT calls with same value of list= adds the address= to the list.

The address value is not an array as result, which is likely the confusion since in most place is RouterOS it would be. Since address= can be DNS name that’s expended with “dynamic” list entires, it be hard for it handle errors if it was an array.

So make a new curl command for each IP you want to add to the list. For example, this sh/bash/zsh loop will create a RouterOS FW address list “google-dns” with two entries for 8.8.4.4 and 8.8.8.8.

for addr in "8.8.8.8" "8.8.4.4"; do \
curl ... "https://192.168.88.1/rest/ip/firewall/address-list" --data " { \"address\": \"$addr\" ,\"list\":\"google-dns\"}" -H "content-type: application/json"; \
done;

Hi there,
I was also looking for something similar to create thousands of hotspot users in my router through the REST API. The documentation cleary states that “Only one resource can be created in a single PUT request.”

So there is absolutely no workaround than using a loop ?

You can add as many attributes for a single user you want in a PUT request, but it’s still one call per user to add them. You can’t add multiple users in a single request however – since the CLI doesn’t have syntax for that either. In CLI, it’s also same series of multiple commands to add hotspot users, same as REST. Basically REST doesn’t do more or less than the RouterOS CLI syntax allows, it’s just another way to call the same CLI commands.