Wiki

Clone wiki

enterobase-web / api_only_fields_parameter

Top level links:

The onlyfields API parameter

Refer to interactive documentation : http://enterobase.warwick.ac.uk/api/v2.0/swagger-ui

onlyfields is a parameter for several query methods in the API and can have one or more values naming available fields in the query results. The outcome is that the query results will only include those fields. The default behaviour - when onlyfields is not set - is for the results to include all of the available fields. When multiple fields are named in a URL used in an HTTP request while using the API then rather than onlyfields being set to a list of fields, each desired field must have a separate onlyfields= term. For example, the HTTP request

http://enterobase.warwick.ac.uk/api/v2.0/senterica/assemblies?only_fields=download_fastq_link&only_fields=n50&barcode=SAL_IA5204AA_AS

uses the assemblies query method in order to obtain the n50 value and a download link for FASTQ data only in the assemblies metadata for the assembly with the barcode SAL_IA5204AA_AS. This gives the result

{
  "Assemblies": [
    {
      "download_fastq_link": "http://enterobase.warwick.ac.uk/upload/download?assembly_barcode=SAL_IA5204AA_AS&database=senterica&file_format=fastq",
      "n50": 406329
    }
  ],
  "links": {
    "paging": {},
    "records": 1,
    "total_records": 1
  }
}

Updated