Bug 19410: (follow-up) Move build_query_params_from_api into a helper