function get_mms_ancillary_file, filename=filename, sc_id=sc_id, product=product, $
  start_date=start_date, end_date=end_date, local_dir=local_dir, public=public

  ; Web API defined with lower case.
  if n_elements(sc_id)   gt 0 then sc_id   = strlowcase(sc_id)
  if n_elements(product) gt 0 then product = strlowcase(product)
 
  ; Build query.
  ; Start by building an array of arguments based on inputs.
  ; Many values may be arrays so join with ",".
  ; Note that a single value will be treated as an array of one by IDL.
  query_args = ["hack"] ;IDL doesn't allow empty arrays before version 8.
  if n_elements(filename)   gt 0 then query_args = [query_args, "file=" + strjoin(filename, ",")]
  if n_elements(sc_id)      gt 0 then query_args = [query_args, "sc_id=" + strjoin(sc_id, ",")]
  if n_elements(product)    gt 0 then query_args = [query_args, "product=" + strjoin(product, ",")]
  if n_elements(start_date) gt 0 then query_args = [query_args, "start_date=" + start_date]
  if n_elements(end_date)   gt 0 then query_args = [query_args, "end_date=" + end_date]
  
  ; Join query args with "&", drop the "hack"
  if n_elements(query_args) lt 2 then query = '' $
  else query = strjoin(query_args[1:*], "&")
  
  ; Execute the query.
  status = download_mms_files("ancillary", query, local_dir=local_dir, public=public)

  return, status  
end
