Example query 2: Count samples connected to a case

QUERY DATASETS > About the Datasets API > Query via the Datasets API > Example query 2: count samples...

To count the number of samples connected to a specific case, use the following query. This example uses a case with the case ID '0004D251-3F70-4395-B175-C94C2F5B1B81' .

Request

POST /datasets/tcga/v0/query/total HTTP/1.1
Host: cgc-datasets-api.sbgenomics.com
X-SBG-Auth-Token: 3210a98c1db9304ea9d9273156740f74
{
    "entity": "samples",
    "hasCase": "0004D251-123A-45B6-B175-C94C2F5B1B81"
}

Response body

The response shows the total number of matching samples.

{
  "total": 2
}
Language