Samples
GET <qbench-url>/qbench/api/v1/sample/{sampleId}
Will retrieve a sample by its ID. A request for a single sample will also include all its tests.
Example request:
GET /qbench/api/v1/sample/1 HTTP/1.1
Authorization: Bearer 63ff42c5-49e6-42e2-bc3f-04fbfc22bbcb
Host: <qbench-url>
Example response:
{
"comments": null,
"date_created": "02/02/2017",
"description": "Example Description",
"id": 1,
"order_id": 1,
"sample_type": "Example Type",
"tests": [
{
"assay_id": 1,
"comments": "Example comment.",
"complete_date": "02/02/2017",
"date_created": "02/02/2017",
"estimated_complete_date": "05/31/2017",
"estimated_start_date": "05/09/2017",
"id": 1,
"results": "Pass",
"sample_id": 1,
"start_date": "02/02/2017",
"state": "COMPLETED",
"tags": [],
"tech_id": null
}
]
}
GET <qbench-url>/qbench/api/v1/sample?page_num={pageNum}&page_size={pageSize}
Will retrieve a paginated list of samples. Maximum page size is 50.
Optional query string params:
- customer_ids (repeatable):
- Will retrieve samples only for a specific customer IDs
- sort_by:
- Specify a field to sort by. Sorting can only be done by QBench defined fields. Custom fields are not supported. The following fields are supported:
- id
- order_id
- date_created
- sample_type
- description
- comments
- sort_order
- Sort ascending or descending. Value must be asc or desc.
- order_id_contains
- Will retrieve Samples where Order ID contains the given string
- sample_id_contains
- Will retrieve Samples where its ID contains the given string
- additional_fields_encoded
- Will retrieve Samples by additional fields
- Encoding Example (Using Python):
-
import json
import base64
params = {
'text_field': 'HELLO WORLD'
}
json_params = json.dumps(params)
additional_fields_encoded = base64.b64encode(json_params.encode())
Example request:
GET /qbench/api/v1/sample?page_num=1&page_size=50 HTTP/1.1
Authorization: Bearer 63ff42c5-49e6-42e2-bc3f-04fbfc22bbcb
Host: <qbench-url>
Example response:
{
"total_count": 75,
"total_pages": 2,
"data": [
{
"description": "Example Desc",
"order_id": 30,
"comments": "Example Comments.",
"test_count": 0,
"sample_type": "Example Type",
"date_created": "05/12/2017",
"id": 52
},
{
"description": "Desc",
"order_id": 30,
"comments": "Comments.",
"test_count": 0,
"sample_type": "Type",
"date_created": "05/12/2017",
"id": 51
},
...
]
}
POST <qbench-url>/qbench/api/v1/sample
Will create a new sample. Child tests CANNOT be included in this request.
Example request:
POST /qbench/api/v1/sample HTTP/1.1
Authorization: Bearer 63ff42c5-49e6-42e2-bc3f-04fbfc22bbcb
Host: <qbench-url>
Content-Type: application/json
{
"description": "Example Description",
"order_id": 1,
"sample_type": "Example Type",
}
Example response:
{"id":6}
Will update an existing sample. Order ID, sample type, and description cannot be null.
POST <qbench-url>/qbench/api/v1/sample/{sampleId}
Example request:
POST /qbench/api/v1/sample/1 HTTP/1.1
Authorization: Bearer 63ff42c5-49e6-42e2-bc3f-04fbfc22bbcb
Host: <qbench-url>
Content-Type: application/json
{
"comments":"Example comments"
}
Example response:
{"message":"OK"}
DELETE <qbench-url>/qbench/api/v1/sample/{sampleId}
Will delete a sample.
Example request:
DELETE /qbench/api/v1/sample/1 HTTP/1.1
Authorization: Bearer 63ff42c5-49e6-42e2-bc3f-04fbfc22bbcb
Host: <qbench-url>
Example response:
{"message":"OK"}
Comments
0 comments
Please sign in to leave a comment.