pass queries as dict and urlencode. api_gen improvements