Skip to content

API Datasets

Brunovski edited this page Dec 28, 2020 · 14 revisions

GET /projects/{project}/datasets

Description: Retrieves the specified page of datasets

Request:

  • URI Params:
    • project (String) Project identifier
  • Query String:
    • page (Integer, Optional) Page to retrieve. Default value is 0
  • Example:
curl --location --request GET 'http://localhost:8080/projects/8fdaea41-23ca-42cc-a3aa-063bb42bb842/datasets?provider=google'
--header 'Authorization: Bearer {Access Token}'

Success Response:

  • Status Code: 200 OK
  • Content: A list of objects with the resumed information of the datasets
  • Content Type:
    • application/json
  • Schema:
[
   {
      "id": String
      "version": Integer
   },
   ...
]
  • Example:
[{"id": "eb6e9c65-8230-4b75-9ecf-d7d453b67102", "version": 1}, {"id": "12c1da88-e997-49d8-be2e-9820245f6ce1", "version": 2}]

Error Responses:

  • 400 Bad Request
  • 401 Unauthorized

Role: User

GET /projects/{project}/datasets/{dataset}

Description: Retrieves the specified dataset

Request:

  • URI Params:
    • project (String) Project identifier
    • dataset (String) Dataset identifier
  • Query String:
    • version (Integer, Optional) Version of the dataset information. Default value is the current version
  • Example:
curl --location --request GET 'http://localhost:8080/projects/8fdaea41-23ca-42cc-a3aa-063bb42bb842/datasets/eb6e9c65-8230-4b75-9ecf-d7d453b67102?provider=google'
--header 'Authorization: Bearer {Access Token}'

Success Response:

  • Status Code: 200 OK
  • Content: An object with the information of the dataset
  • Content Type:
    • application/json
  • Schema:
{
   "project_id": String
   "id": String
   "version": Integer
   "deprecated": Boolean
   "description": String
   "schema": {"taxon_id": String, "id": String, "version": Integer, "deprecated": Boolean}
}
  • Example:
{
   "project_id": "8fdaea41-23ca-42cc-a3aa-063bb42bb842",
   "id": "eb6e9c65-8230-4b75-9ecf-d7d453b67102",
   "version": 1,
   "deprecated": false,
   "description": "Example dataset",
   "schema": {"taxon_id": "bbacilliformis", "id": "mlst7", "version": 1, "deprecated": false}
}

Error Responses:

  • 404 Not Found
  • 401 Unauthorized

Role: User

PUT /projects/{project}/datasets/{dataset}

Description: Updates the specified dataset. The dataset is updated only if the associated schema exists, and the schema must be the same that it had, in case of already having profiles. If the dataset doesn't have any profiles, then the schema can be different.

Request:

  • URI Params:
    • project (String) Project identifier
    • dataset (String) Dataset identifier
  • Content: An object with the dataset information
  • Content Type:
    • application/json
  • Schema:
{
   "id": String
   "taxon_id": String
   "schema_id": String
   "description": String
}
  • Example:
curl --location --request PUT 'http://localhost:8080/projects/8fdaea41-23ca-42cc-a3aa-063bb42bb842/datasets/eb6e9c65-8230-4b75-9ecf-d7d453b67102?provider=google'
--header 'Content-Type: application/json'
--header 'Authorization: Bearer {Access Token}'
--data-raw '{
	"id": "eb6e9c65-8230-4b75-9ecf-d7d453b67102",
	"taxon_id": "bbacilliformis",
	"schema_id": "mlst7",
	"description": "Example dataset"
}'

Success Response:

  • Status Code: 204 No Content

Error Responses:

  • 400 Bad Request
  • 401 Unauthorized

Role: User

POST /projects/{project}/datasets

Description: Creates the specified dataset. The dataset is created only if the associated schema exists.

Request:

  • URI Params:
    • project (String) Project identifier
  • Content: An object with the dataset information
  • Content Type:
    • application/json
  • Schema:
{
   "taxon_id": String
   "schema_id": String
   "description": String
}
  • Example:
curl --location --request POST 'http://localhost:8080/projects/8fdaea41-23ca-42cc-a3aa-063bb42bb842/datasets?provider=google'
--header 'Content-Type: application/json'
--header 'Authorization: Bearer {Access Token}'
--data-raw '{
	"taxon_id": "bbacilliformis",
	"schema_id": "mlst7",
	"description": "Example dataset"
}'

Success Response:

  • Status Code: 201 Created
  • Content: An object with an id to identify the created dataset
  • Content Type:
    • application/json
  • Schema:
{
   "id": String
}
  • Example:
{
   "id": "b0145762-abb8-438b-a8a7-5800a633668a"
}

Error Responses:

  • 400 Bad Request
  • 401 Unauthorized

Role: User

DELETE /projects/{project}/datasets/{dataset}

Description: Deprecates the specified dataset

Request:

  • URI Params:
    • project (String) Project identifier
    • dataset (String) Dataset identifier
  • Example:
curl --location --request DELETE 'http://localhost:8080/projects/8fdaea41-23ca-42cc-a3aa-063bb42bb842/datasets/eb6e9c65-8230-4b75-9ecf-d7d453b67102?provider=google'
--header 'Authorization: Bearer {Access Token}'

Success Response:

  • Status Code: 204 No Content

Error Responses:

  • 401 Unauthorized

Role: User

Clone this wiki locally