run script via REST API

It shouldn’t work like that… but some stuff does vary by command. It might just map both “.id” to “numbers=”* as the “$1”/unnamed argument to /system/script/run and let that command sort it out. (* “numbers” is .id’s cousin, and weird too, sometimes it can be a name not number too). Now, I’d avoid using name in .id, since that’s not consistent with some/most calls. And seems a bug fix away from not working in future.

If you’re using curl, few options to a “lookup by name”:

  1. If familiar with jq, it’s likely better to a GET to find all ids, pipe that to jq to filter the one you want, and pipe again to a 2nd curl with the id

  2. There is the .query syntax offered by REST API on a POST ending in /print. It’s still two REST calls, one to find .id by name (adding .query “stack” to JSON in 1st POST), the 2nd to /system/script/run. This thread has some example of using .query: http://forum.mikrotik.com/t/how-using-query-stack-in-rest-api/173298/1 & links to others with more .query examples

  3. Lookup the .id on RouterOS using “/system/script/print show-id”. That won’t change unless you delete the script. One call and easy.