Overview
Accessing the service
The BioSamples API is organized around REST. It provides predictable, resource-oriented URLs and uses HTTP response codes to indicate API errors. It leverages HTTP features such as authentication, verbs, and content negotiation.
Hypermedia
This API uses hypermedia—the responses include links to other resources. Responses follow the HAL format and contain _links, which clients should use to navigate between resources. Links may be templated (RFC 6570) and require expansion before use.
Link naming conventions:
Each resource includes a self link (the canonical URL).
Individual resources: named with singular type name (e.g., sample).
Collections: named with camelCased plurals (e.g., samples, curations, curationLinks).
Refer to the Links section for a list of all available API links.
Content negotiation for data representation
BioSamples supports multiple serialization formats via HTTP content negotiation. Although JSON is recommended for API interactions, other supported formats include:
Type |
Header |
Comments |
|---|---|---|
HTML |
|
— |
JSON |
|
Recommended |
JSON-LD |
|
Use to serve BioSchemas content |
XML |
|
Soon to be deprecated |
HTTP conventions
Authentication
Authentication is managed via a JWT token in the HTTP request header. For more details see the authentication guide In examples requiring authorization, use $TOKEN as a placeholder.
Supported HTTP verbs
BioSamples API follows HTTP method conventions with HTTP verbs for each action. See below for the list of verbs available in the BioSamples API.
Verb |
Description |
|---|---|
|
Used for retrieving resources |
|
Used for creating resources |
|
Used to entirely replace resources |
|
Can be used to determine which verbs can be used for a resource |
|
Returns whether a resource is available |
|
Used to add structured data (e.g. antibiogram data) to existing samples |
HTTP Status codes
The API uses standard HTTP status codes to indicate request outcomes. For a full reference, see MDN Web Docs.
Code |
Description |
|---|---|
|
The request completed successfully. |
|
Returned after a successful |
|
The request was malformed. The response body will include details about the issue. |
|
The request did not include an |
|
The client is not permitted to access this resource. |
|
The HTTP method is not allowed on this resource. |
HTTPS vs HTTP
BioSamples is served exclusively over HTTPS in line with EMBL-EBI’s security guidelines. Refer to the linked Technical Services Cluster blog post for full details.