Skip to content

API Profiles

Cátia Raquel Jesus Vaz edited this page Nov 26, 2023 · 18 revisions

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

Description: Retrieves the specified page of profiles

Request:

  • URI Params:
    • project (String) Project identifier
    • dataset (String) Dataset 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/eb6e9c65-8230-4b75-9ecf-d7d453b67102/profiles?provider=google'
--header 'Authorization: Bearer {Access Token}'

Success Response:

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

Error Responses:

  • 400 Bad Request
  • 401 Unauthorized

Role: User

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

Description: Retrieves the specified profile

Request:

  • URI Params:
    • project (String) Project identifier
    • dataset (String) Dataset identifier
    • profile (String) Profile identifier
  • Query String:
    • version (Integer, Optional) Version of the profile 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/profiles/1?provider=google'
--header 'Authorization: Bearer {Access Token}'

Success Response:

  • Status Code: 200 OK
  • Content: An object with the information of the profile
  • Content Type:
    • application/json
  • Schema:
{
   "project_id": String
   "dataset_id": String
   "id": String
   "version": Integer
   "deprecated": Boolean
   "aka": String
   "alleles": [{ "id": String, "project_id": String (Optional), "version": Integer}]
}
  • Example:
{
   "project_id": "8fdaea41-23ca-42cc-a3aa-063bb42bb842",
   "dataset_id": "eb6e9c65-8230-4b75-9ecf-d7d453b67102",
   "id": "1",
   "version": 1,
   "deprecated": false,
   "aka": "Example profile",
   "alleles": [{ "id": "1", "version": 1}, { "id": "2", "version": 2}, { "id": "3", "version": 1}, { "id": "1", "version": 2}, { "id": "3", "version": 1}, { "id": "2", "version": 1}, { "id": "2", "version": 3}]
}

Error Responses:

  • 404 Not Found
  • 401 Unauthorized

Role: User

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

Description: Retrieves the specified page of profiles in formatted string (mlst, mlva or snp, depending on the schema associated to the dataset)

Request:

  • URI Params:
    • project (String) Project identifier
    • dataset (String) Dataset 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/eb6e9c65-8230-4b75-9ecf-d7d453b67102/profiles/files?provider=google'
--header 'Authorization: Bearer {Access Token}'

Success Response:

  • Status Code: 200 OK
  • Content: A string with the respective page of profiles formatted in mlst, mlva or snp, depending on the schema associated to the dataset
  • Content Type:
    • text/plain
  • Example:
1   1   2   3   1   3   2   2
2   2   2   1   3   3   1   3

Error Responses:

  • 400 Bad Request
  • 401 Unauthorized

Role: User

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

Description: Stores the specified profile. It stores the profile only if all the non-missing alleles exist, and at least one allele is not missing.

Request:

  • URI Params:
    • project (String) Project identifier
    • dataset (String) Dataset identifier
    • profile (String) Profile identifier
  • Query String:
    • private_alleles (Boolean, Optional) Indicates if the alleles are private. Default value is false
  • Content: An object with the information of the profile
  • Content Type:
    • application/json
  • Schema:
{
   "id": String
   "aka": String
   "alleles": String[]
}
  • Example:
curl --location --request PUT 'http://localhost:8080/projects/8fdaea41-23ca-42cc-a3aa-063bb42bb842/datasets/eb6e9c65-8230-4b75-9ecf-d7d453b67102/profiles/1?provider=google'
--header 'Content-Type: application/json'
--header 'Authorization: Bearer {Access Token}'
--data-raw '{
	"id": "1",
	"aka": "bbacilliformis",
	"alleles": ["1", "2", "3", "1", "3", "2", "2"],
}'

Success Response:

  • Status Code: 204 No Content

Error Responses:

  • 400 Bad Request
  • 401 Unauthorized

Role: User

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

Description: Stores the profiles of the file

Request:

  • URI Params:
    • project (String) Project identifier
    • dataset (String) Dataset identifier
  • Query String:
    • private_alleles (Boolean, Optional) Indicates if the alleles are private. Default value is false
    • file (File) File that contains the profiles
  • Content: A file with profiles formatted in mlst, mlva or snp
  • Content Type:
    • multipart/form-data
  • Example:
curl --location --request PUT 'http://localhost:8080/projects/8fdaea41-23ca-42cc-a3aa-063bb42bb842/datasets/eb6e9c65-8230-4b75-9ecf-d7d453b67102/profiles/files?provider=google'
--header 'Content-Type: multipart/form-data'
--header 'Authorization: Bearer {Access Token}'
--form 'file=@/filelocation/filename.txt'

Success Response:

  • Status Code: 200 OK
  • Content: An object with the invalid lines and invalid alleles
  • Content Type:
    • application/json
  • Schema:
{
   "invalid_lines": Integer[]
   "invalid_entities": String[]
}
  • Example:
{
   "invalid_lines": [1, 2],
   "invalid_entities": ["3"]
}

Error Responses:

  • 400 Bad Request
  • 401 Unauthorized

Role: User

POST /projects/{project}/datasets{dataset}/profiles/files

Description: Stores the non-existing profiles of the file

Request:

  • URI Params:
    • project (String) Project identifier
    • dataset (String) Dataset identifier
  • Query String:
    • private_alleles (Boolean, Optional) Indicates if the alleles are private. Default value is false
    • file (File) File that contains the profiles
  • Content: A file with profiles formatted in mlst, mlva or snp
  • Content Type:
    • multipart/form-data
  • Example:
curl --location --request POST 'http://localhost:8080/projects/8fdaea41-23ca-42cc-a3aa-063bb42bb842/datasets/eb6e9c65-8230-4b75-9ecf-d7d453b67102/profiles/files?provider=google'
--header 'Content-Type: multipart/form-data'
--header 'Authorization: Bearer {Access Token}'
--form 'file=@/filelocation/filename.txt'

Success Response:

  • Status Code: 200 OK
  • Content: An object with the invalid lines and invalid alleles
  • Content Type:
    • application/json
  • Schema:
{
   "invalid_lines": Integer[]
   "invalid_entities": String[]
}
  • Example:
{
   "invalid_lines": [1, 2],
   "invalid_entities": ["3"]
}

Error Responses:

  • 400 Bad Request
  • 401 Unauthorized

Role: User

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

Description: Deprecates the specified profile

Request:

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

Success Response:

  • Status Code: 204 No Content

Error Responses:

  • 401 Unauthorized

Role: User

Clone this wiki locally