Skip to content

API Schemas

Alexandre P Francisco edited this page Jun 20, 2023 · 14 revisions

GET /taxa/{taxon}/schemas

Description: Retrieves the specified page of schemas

Request:

  • URI Params:
    • taxon (String) Taxon identifier
  • Query String:
    • page (Integer, Optional) Page to retrieve. Default value is 0
  • Example:
curl --location --request GET 'http://localhost:8080/taxa/bbacilliformis/schemas?provider=google'
--header 'Authorization: Bearer {Access Token}'

Success Response:

  • Status Code: 200 OK
  • Content: A list of objects with the resumed information of the schemas
  • Content Type:
    • application/json
  • Schema:
[
   {
      "id": String
      "version": Integer
   },
   ...
]
  • Example:
[{"id": "mlst7", "version": 1}, {"id": "mlst14", "version": 2}]

Error Responses:

  • 400 Bad Request
  • 401 Unauthorized

Role: User

GET /taxa/{taxon}/schemas/{schema}

Description: Retrieves the specified schema

Request:

  • URI Params:
    • taxon (String) Taxon identifier
    • schema (String) Schema identifier
  • Query String:
    • version (Integer, Optional) Version of the schema information. Default value is the current version
  • Example:
curl --location --request GET 'http://localhost:8080/taxa/bbacilliformis/schemas/mlst7?provider=google'
--header 'Authorization: Bearer {Access Token}'

Success Response:

  • Status Code: 200 OK
  • Content: An object with the information of the schema
  • Content Type:
    • application/json
  • Schema:
{
   "taxon_id": String
   "id": String
   "version": Integer
   "deprecated": Boolean
   "type": String
   "description": String
   "loci": [{"id": String,  "version": Integer}]
}
  • Example:
{
   "taxon_id": "bbacilliformis",
   "id": "mlst7",
   "version": 1,
   "deprecated": false,
   "type": "mlst",
   "description": "Example schema",
   "loci": [{"id": "ftsZ",  "version": 1}]
}

Error Responses:

  • 404 Not Found
  • 401 Unauthorized

Role: User

PUT /taxa/{taxon}/schemas/{schema}

Description: Stores the specified schema. It stores the schema only if all the composing loci exist and a different schema with the same loci doesn't exist already.

Request:

  • URI Params:
    • taxon (String) Taxon identifier
    • schema (String) Schema identifier
  • Content: An object with the information of the schema
  • Content Type:
    • application/json
  • Schema:
{
   "taxon_id": String
   "id": String
   "type": String - "mlst", "mlva" or "snp"
   "description": String
   "loci": String[]
}
  • Example:
curl --location --request PUT 'http://localhost:8080/taxa/bbacilliformis/schemas/mlst7?provider=google'
--header 'Content-Type: application/json'
--header 'Authorization: Bearer {Access Token}'
--data-raw '{
	"taxon_id": "bbacilliformis",
	"id": "mlst7",
	"type": "mlst",
	"description": "demo 7 loci schema",
	"loci": ["glpF", "ilvD", "pta", "purH", "pycA", "rpoD", "tpiA"]
}'

Success Response:

  • Status Code: 204 No Content

Error Responses:

  • 400 Bad Request
  • 401 Unauthorized

Role: Admin

DELETE /taxa/{taxon}/schemas/{schema}

Description: Deprecates the specified schema

Request:

  • URI Params:
    • taxon (String) Taxon identifier
    • schema (String) Schema identifier
  • Example:
curl --location --request DELETE 'http://localhost:8080/taxa/bbacilliformis/schemas/mlst7?provider=google'
--header 'Authorization: Bearer {Access Token}'

Success Response:

  • Status Code: 204 No Content

Error Responses:

  • 401 Unauthorized

Role: Admin