Bug 19410: Move build_query_params_from_api into a helper