Groovy web console

subscribe to the feed Subscribe
to this
site
report type (via #groovywebconsole)
tweet this snippet Tweet
this
script

report type

Published 1 month ago by wojtek
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def request = '/rpc/report/admin/customer?count=10&filter%5BexcludeTestAffiliates%5D=true&filter%5Bfrom%5D=2017-02-01T00:00:00&filter%5Bto%5D=2017-02-16T23:59:59&groupBy=monthly&last=1&page=1'
// request = '/rpc/report/channels?affiliate=100117&count=10&filter%5Bfrom%5D=2017-02-01T00:00:00&filter%5Bto%5D=2017-02-17T10:32:36&last=1&page=1'
def parts = request.split('/')
def result = ''
println parts
if (parts[2] == 'report') {
    if (parts.length == 5) {
        result = parts[3] + ' '
    }
    result += parts[-1].split('\\?')[0]

} else {
    result = 'no match'
}

println result