Example query 1: Find samples connected to a case

If you want to filter all samples that are connected to a TCGA case with case ID '0004D251-3F70-4395-B175-C94C2F5B1B81,' you can use the following query:

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

This request returns the response below. Note that it contains two sample objects: one for each sample matching the query above.

{
  "count": 2,
  "_embedded": {
    "samples": [
      {
        "id": "9259E9EE-12A3-456B-8512-509CB705029C",
        "label": "9259E9EE-12A3-456B-8512-509CB705029C",
        "_links": {
          "self": {
            "href": "cgc-datasets-api.sbgenomics.com/datasets/tcga/v0/samples/9259E9EE-12A3-456B-8512-509CB705029C"
          }
        }
      },
      {
        "id": "9EA47C2E-78C9-456D-99F0-F9B50A4729A6",
        "label": "9EA47C2E-78C9-456D-99F0-F9B50A4729A6",
        "_links": {
          "self": {
            "href": "cgc-datasets-api.sbgenomics.com/datasets/tcga/v0/samples/9EA47C2E-78C9-456D-99F0-F9B50A4729A6"
          }
        }
      }
    ]
  }
}

For each sample returned, the response lists:

  • Its href: this is a path that can be used to obtain full information about the sample. The response returned when issuing a GET request to this path is reproduced below.
  • Its TCGA id
  • Its TCGA label

Secondary request

Issuing a GET request to the href path will return the following data:

{
  "_links": {
    "hasCase": {
      "href": "https://cgc-datasets-api.sbgenomics.com/datasets/tcga/v0/samples/9EA47C2E-78C9-456D-99F0-F9B50A4729A6/cases"
    },
    "hasFile": {
      "href": "https://cgc-datasets-api.sbgenomics.com/datasets/tcga/v0/samples/9EA47C2E-78C9-456D-99F0-F9B50A4729A6/files"
    },
    "hasPortion": {
      "href": "https://cgc-datasets-api.sbgenomics.com/datasets/tcga/v0/samples/9EA47C2E-78C9-456D-99F0-F9B50A4729A6/portions"
    },
    "self": {
      "href": "https://cgc-datasets-api.sbgenomics.com/datasets/tcga/v0/samples/9EA47C2E-78C9-456D-99F0-F9B50A4729A6"
    }
  },
  "hasTissueSourceSite": "Mayo Clinic - Rochester",
  "hasID": "TCGA-DD-AAVP-10A",
  "hasDaysToCollection": 2467,
  "hasOctEmbedded": "false",
  "id": "9EA47C2E-78C9-456D-99F0-F9B50A4729A6",
  "hasSampleType": "Blood Derived Normal",
  "label": "9EA47C2E-78C9-456D-99F0-F9B50A4729A6",
  "hasIsFFPE": "NO",
  "hasCountryOfSampleProcurement": "Korea South",
  "hasTissueSourceSiteCode": "DD",
  "hasSampleTypeCode": "10"
}
Language