## Bank update service

This service allows the owner of a bank, or a member of the bank owner group, to start a standard update for that bank :
`<BW URL>/GET?update=<bank_name>&key=<user_key>`

## Bank download service

This service allows one to download a specific file or directory for a given bank with the following syntax :

`<BW URL>/GET?bank=<bank_name>&path=<path>[&=version=<version>&zip=<true|false>&key=<user_key>]`

- path and bank parameters are mandatory.
- bank is the bank name to consider.
- version is the version of the bank to consider. If not specified, default value is current
- path is the relative path to the file or directory to download (relative to <bank>/<version>, e.g. flat/dir/file1). To download the whole version, leave that parameter empty.
- If path points at a directory, a zip archive will be provided by default.
- zip parameter only applies to files.
- If the bank is private, an authentication key is required. This is done with key parameter.
  Access will be granted only if you belong to the group the bank owner belongs to.
  Your key is available in your user panel in the web interface.

Examples :

- `<BW URL>/GET?bank=tgi&path=flat/Acyrthosiphon_pisum` : Download content of flat/Acyrthosiphon_pisum directory as a zip archive.
- `<BW URL>/GET?bank=NR&version=2011-04-27&path=fasta/All/all.fasta` : Download file all.fasta.
- `<BW URL>/GET?bank=NR&version=2011-04-27&path=fasta/All/all.fasta&zip=true` : Download file all.fasta as a zip archive.

## Bank querying service

BW provides a REST service that allows the user to retrieve information on the banks in JSON format via the URL.

You can get 3 types of result :

- The formats list : <BW URL>/GET?formats
  {
  "formats":[
  {
  "value":"blast"
  },
  {
  "value":"emboss"
  },
  {
  "value":"fasta"
  }
  ]
  }
- The types list : <BW URL>/GET?types
  {
  "types":[
  {
  "value":"aphidbase/nucleic"
  },
  {
  "value":"aphidbase/proteic"
  },
  {
  "value":"gene/duplicate"
  }
  ]
  }
- The banks list (URL format is described below) : The structure of the JSON object is the following :
  {
  "banks":[
  {
  "name":"bank name",
  "session_date":"session date",
  "current_release":"release number",
  "releases":{
  "release number":{
  "path":"directory path",
  "formats":[
  {
  "value":"format 1",
  "sections":[
  {
  "name":"section name",
  "files":[
  "filepath_1",...,"filepath_n"
  ],
  "sections":[
  ...
  ]
  },...
  ]
  },
  {
  "value":"format 2",
  "sections":[
  ...
  ]
  }
  ]
  },
  ...
  },
  "db_type":"bank type"
  }...
  ]
  }
  For each format, a list of the associated files is returned as a section element. A section structures the files according to their directory structure. Here is an example :
  Directory structure :
  fasta
  |- dir_1
  | |- dir_11
  | | |- file_a
  | | |- file_b
  | |- dir_12
  | |- file_c
  |- dir_2
  |- file_d
  |- dir_21
  |- file_e
  Sections :
  "format":[
  {
  "value":"fasta",
  "sections":[
  {
  "name":"dir_1",
  "sections":[
  {
  "name":"dir_11",
  "files":[
  "file_a","file_b"
  ]
  },
  {
  "name":"dir_12",
  "files":[
  "file_c"
  ]
  }
  ]
  },
  {
  "name":"dir_2",
  "files":[
  "file_d"
  ],
  "sections":[
  {
  "name":"dir_21",
  "files":[
  "file_e"
  ]
  }
  ]
  }
  ]
  }
  ]
  You can specify 4 parameters to retrieve the bank list.
  - banks (mandatory) : Can be either the bank name or "all" to retrieve all the banks.
  - formats (optional) : Can be either a specific format or "all". Multiple formats are separated with | character.
  - types (optional) : Can be either a specific type or "all". Multiple types are separated with | character.
  - lightmode (optional) : Use these parameter if you don't need the formats directories to be listed.
  - nocache (optional) : Do not use cache. This will cause the cache to be refreshed. The cache mainly contains the files contained in each bank.
  - key (optional) : Authenticate with an user key. If not provided, only the public banks are available.
  Examples :
  All banks with fasta format and lightmode enabled :
  <BW URL>/GET?banks=all&formats=fasta&lightmode
  All banks with fasta format and nucleic type :
  <BW URL>/GET?banks=all&formats=fasta&types=nucleic
  All banks with fasta or xml format and nucleic or proteic type :
  <BW URL>/GET?banks=all&formats=fasta|xml&types=nucleic|proteic
  Genbank bank only if it has fasta format :
  <BW URL>/GET?banks=genbank&formats=fasta
  Genbank with no cache :
  <BW URL>/GET?banks=genbank&nocache