Orders
GET <qbench-url>/qbench/api/v1/order/{orderId}
Will retrieve an order by its ID. A request for a single order will also include all its samples and each those sample's tests.
Example request:
GET /qbench/api/v1/order/1 HTTP/1.1
Authorization: Bearer 63ff42c5-49e6-42e2-bc3f-04fbfc22bbcb
Host: <qbench-url>
Example response:
{
"customer_account_id": 1,
"date_created": "02/02/2017",
"date_received": "03/07/2017",
"id": 1,
"samples": [
{
"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
}
]
},
{
"comments": null,
"date_created": "02/02/2017",
"description": "Example Description",
"id": 2,
"order_id": 1,
"sample_type": "Example Type",
"tests": [
{
"assay_id": 1,
"comments": null,
"complete_date": null,
"date_created": "02/02/2017",
"estimated_complete_date": "05/19/2017",
"estimated_start_date": "05/12/2017",
"id": 2,
"results": null,
"sample_id": 2,
"start_date": null,
"state": "NOT STARTED",
"tags": [],
"tech_id": null
}
]
},
{
"comments": null,
"date_created": "02/02/2017",
"description": "Example Description",
"id": 3,
"order_id": 1,
"sample_type": "Example Type",
"tests": [
{
"assay_id": 1,
"comments": null,
"complete_date": null,
"date_created": "02/02/2017",
"estimated_complete_date": "05/08/2017",
"estimated_start_date": "05/08/2017",
"id": 3,
"results": null,
"sample_id": 3,
"start_date": null,
"state": "NOT STARTED",
"tags": [],
"tech_id": null
}
]
}
],
"state": "COMPLETED",
"submitted_by": null,
"tags": [
"new",
"tags"
]
}
GET <qbench-url>/qbench/api/v1/order?page_num={pageNum}&page_size={pageSize}
Will retrieve a paginated list of orders. A list of orders will include each order's sample and test count. Maximum page size is 50.
Optional query string params:
- customer_ids (repeatable):
- Will retrieve orders 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
- customer_account_id
- date_created
- date_received
- submitted_by
- state
- sort_order
- Sort ascending or descending. Value must be asc or desc.
Example request:
GET /qbench/api/v1/order?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": [
{
"submitted_by": null,
"sample_count": 2,
"customer_account_id": 1,
"tags": [
"order",
"tags"
],
"test_count": 0,
"date_received": "03/07/2017",
"state": "COMPLETED",
"date_created": "05/12/2017",
"id": 30
},
{
"submitted_by": null,
"sample_count": 1,
"customer_account_id": 1,
"tags": [
"order",
"tags"
],
"test_count": 1,
"date_received": "03/07/2017",
"state": "CREATED",
"date_created": "05/12/2017",
"id": 29
},
...
]
}
POST <qbench-url>/qbench/api/v1/order
Will create a new order. When creating an order, you can also include samples and tests. Customer ID and Date Received are required for the order, sample type and description are required for each sample, and assay ID is required for each test.
Example request:
POST /qbench/api/v1/order HTTP/1.1
Authorization: Bearer 63ff42c5-49e6-42e2-bc3f-04fbfc22bbcb
Host: <qbench-url>
Content-Type: application/json
{
"customer_account_id":1,
"date_received":"03/07/2017 3:53 PM",
"tags":["order","tags"],
"samples":[
{
"sample_type":"Example type",
"description":"Example desc",
"comments":"Example comments",
"tests":[
{
"assay_id":1,
"tech_id":1,
"tags":["test","tags"]
}
]
}
]
}
Example response:
{"id":5}
POST <qbench-url>/qbench/api/v1/order/{orderId}
Will update an existing order. Customer ID and date received cannot be null.
Example request:
POST /qbench/api/v1/order/1 HTTP/1.1
Authorization: Bearer 63ff42c5-49e6-42e2-bc3f-04fbfc22bbcb
Host: <qbench-url>
Content-Type: application/json
{
"submitted_by":"example@example.com"
}
Example response:
{"message":"OK"}
DELETE <qbench-url>/qbench/api/v1/order/{orderId}
Will delete an order.
Example request:
DELETE /qbench/api/v1/order/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.