def host = '127.0.0.1' def port = 8989 def auth = 'YOUR_API_KEY' def ids = model.findAll{ it.type =~ /Episode/ }.findResults{ it.tvdbId } as Set ids.each{ id -> def r = curl "http://${host}:${port}/api/v3/series?tvdbId=${id}", 'X-Api-Key': auth r.each{ s -> curl "http://${host}:${port}/api/v3/command", [name: 'rescanSeries', seriesId: s.id], 'X-Api-Key': auth } }