Place an order and register the DNA kit via the API endpoints
0. Get item and country
Before placing the order you need to get the id of the DNA kit item and the countries where that item can be shipped to.
To get the item use the GET /item/dna-kit-item/ endpoint, you will get a list of items available, use the id of the item with the name: dna-kit or dna-kit-unbranded (SD branded or generic branding kit respectively).
Once you have the id of the item, you should get the available countries where the item ships, use the following endpoint: https://{domain}/service/payments/product/{item_id}/shipping-location/ and get the country field to use when creating the order. For example, in QA for a dna-kit item you would use this endpoint: https://qa-selfdecode.com/service/payments/product/a1f0261d-53fb-4c7b-8088-05785d558597/shipping-location/
1. Place an order
To place an order you can use the following payload in the POST /order/ endpoint. You should change the shipping information accordingly.
Basic payload to create an order:
{
"ship_to_name": "Test Name",
"ship_to_address": "address",
"ship_to_city": "city",
"ship_to_state": "State",
"ship_to_postal_code": "12345",
"ship_to_country": "Canada",
"phone_number": "1234567890",
"line_items": [
{
"quantity": 1,
"item": "a1f0261d-53fb-4c7b-8088-05785d558597"
}
]
}
The response will have the id of the order created, which can be used later to fetch data about the order using the GET /order/{id}/ endpoint.
2. DNA kit created
After the order is created, the initial status is received, within one hour the status will change to submitted, which means the kit is being prepared by the supplier.
After the kit is shipped, the packages field in the order retrieve endpoint will have the information about the shipping like supplier_package_id, tracking_number and supplier_order_number. And a DNASample will be created with the stage shipped, this will contain the information about the kit, and you can fetch them in the GET /product/dna-sample/ endpoint.
3. Register kit
Registering a kit is the process of assigning a profile to a specific sample. So we need to previously create a profile to attach the profile_id and change the status of the kit from shipped to activated. In order to do this from the API you need to use the PUT /product/dna-sample/{sample_id}/ endpoint with the following payload:
{
"user_id": "2d595120-2ff6-4997-9389-f4471f8d29a4",
"stage": "activated",
"profile": "5bfdf378-10ae-4f65-8ba8-584df4efdd3d"
}
Things to keep in mind:
- The
sample_idin the URL is thesample_idreturned in the GET /product/dna-sample/ endpoint, usually starts with GFXC with some numbers, for example,GFXC123456. - The
user_idis also returned in thedna-sampleendpoint as well as thedna-kit-orderendpoint. - The
stageshould always beactivated. - The
profileis theidreturned when the profile was created.
4. Sample processing
After the kit is registered, the sample should be returned to the lab, and the stage of the DNA sample will change depending on the status of the kit:
stage | Kit status |
|---|---|
| shipped | Initial kit status after is sent by the provider |
| activated | Kit registered and returned to the lab |
| sample_received | Kit received by the lab |
| low_quality | Sample analyzed but it's low quality |
| missing_profile | Sample analyzed but there is no profile attached to it, you need to register the kit to a specific profile (see previous step) |
| sample_analyzed | Sample has been analyzed by the lab |
| complete | The Genome File for the sample will start processing |
Once the sample is in stage=complete the genome file will start processing, and the VCF will be available in about 2 hours after the kit is changed to this stage. To get the file, you can refer to the GET /service/genome-files/file/ endpoint.
