API query question

63 views
Skip to first unread message

Costello, Heather

unread,
Mar 18, 2025, 3:56:44 AM3/18/25
to cbiop...@googlegroups.com, Gao, JJ

Hello all,

 

I am trying to collect data from the pediatric datasets via the API, and I am using study pptc_2019 as my “tester”.

I’m having difficulty fetching the mutation data. I see in the documentation on https://www.cbioportal.org/api/swagger-ui/index.html that I should be using the following location/command:

/api/molecular-profiles/{molecularProfileID}/mutations

 

However, it also says that it requires the sampleListId for this query. I am not sure how to pass this information. My script is:


A screenshot of a computer code

Description automatically generated

 

The error message is:

 

Error 400: {"message":"Request parameter is missing: sampleListId"}

 

 

I would like to use sampleListId “pptc_2019_sequenced”.

 

Thank you for your time in checking this over!

 

 

Heather Costello
Institute for Genomic Medicine

Nationwide Children’s Hospital

Aaron L

unread,
Mar 18, 2025, 8:09:11 AM3/18/25
to Costello, Heather, cbiop...@googlegroups.com, Gao, JJ
Hi Heather, 
You need to use the post endpoint.   "/api/molecular-profiles/{molecularProfileId}/mutations/fetch"
If you look in the swagger documentation, it will show you what the posted data should look like. In your script you'll want to use
request.post instead of request.get.

This is a case where ChatGPT will probably be able to help you a lot!







--
You received this message because you are subscribed to the Google Groups "cBioPortal for Cancer Genomics Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cbioportal+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/cbioportal/PH0PR14MB443953A31ECFCCC732F06CBE8ADF2%40PH0PR14MB4439.namprd14.prod.outlook.com.

JJ Gao

unread,
Mar 18, 2025, 10:26:44 AM3/18/25
to Aaron L, Costello, Heather, cbiop...@googlegroups.com, Gao, JJ
Hi Heather,

Are you trying to test the API? Or are you getting the mutation data to test the import process for your local instance? If the latter, you can download the whole study - see screenshot below.

image.png

Best,
-JJ

Aaron L

unread,
Mar 18, 2025, 12:12:17 PM3/18/25
to Costello, Heather, JJ Gao, cbiop...@googlegroups.com, Gao, JJ, Goar, Wes, Cannon, Matthew, Wagner, Alex
Heather it would be something like the following code, where the data variable is set to something like this.  Note that for sampleIds and sampleListId, you only need to specify one.

{
  "sampleIds": [
    "string"
  ],
  "sampleListId": "string",
  "entrezGeneIds": [
    1073741824
  ]
}

url = 'https://httpbin.org/post'  # Example URL that echoes POST data
data = {'key1': 'value1', 'key2': 'value2'}

response = requests.post(url, data=data)

print(f"Status Code: {response.status_code}")
print("Response Body:", response.json())

On Tue, Mar 18, 2025 at 12:06 PM Costello, Heather <Heather....@nationwidechildrens.org> wrote:

Hi JJ and Aaron,

 

Thank you Aaron, that was definitely helpful. Unfortunately, even using ChatGPT, I’m still having difficulty formatting my script to get the information I need.

 

Thank you JJ, I have actually already downloaded the pediatric datasets and explored them to a significant extent. We are updating a knowledge database to include peds cBioPortal data. Ideally, we’d like to access it programmatically to keep that flexibility for possible future expansion of the datasets/studies we are pulling.  

 

I have copied the project owner (Alex Wagner) and two scientists I am working with on this effort (Matthew Cannon and Wesley Goar) in case they would like to weigh in.

 

Best,

 

Heather Costello

 

From: JJ Gao <jianji...@gmail.com>
Date: Tuesday, March 18, 2025 at 10:26
AM
To: Aaron L <lisman...@gmail.com>
Cc: Costello, Heather <Heather....@nationwidechildrens.org>, cbiop...@googlegroups.com <cbiop...@googlegroups.com>, Gao, JJ <ga...@mskcc.org>
Subject: Re: [cbioportal] API query question

Hi Heather, Are you trying to test the API? Or are you getting the mutation data to test the import process for your local instance? If the latter, you can download the whole study - see screenshot below. Best, -JJ On Tue, Mar 18, 2025 at 8:09

ZjQcmQRYFpfptBannerStart

This Message Is From an Untrusted Sender

You have not previously corresponded with this sender.

Search “email warning banner” on ANCHOR for more information

 

ZjQcmQRYFpfptBannerEnd

Hi Heather,

 

Are you trying to test the API? Or are you getting the mutation data to test the import process for your local instance? If the latter, you can download the whole study - see screenshot below.

 

Costello, Heather

unread,
Mar 24, 2025, 8:01:08 AM3/24/25
to Aaron L, JJ Gao, cbiop...@googlegroups.com, Gao, JJ, Goar, Wes, Cannon, Matthew, Wagner, Alex

Thanks so much, Aaron, this was a big help. My first time with a REST API, I’ve been bumbling 😊

 

From: Aaron L <lisman...@gmail.com>
Date: Tuesday, March 18, 2025 at 12:14
PM
To: Costello, Heather <Heather....@nationwidechildrens.org>
Cc: JJ Gao <jianji...@gmail.com>, cbiop...@googlegroups.com <cbiop...@googlegroups.com>, Gao, JJ <ga...@mskcc.org>, Goar, Wes <Wesle...@nationwidechildrens.org>, Cannon, Matthew <Matthew...@nationwidechildrens.org>, Wagner, Alex <Alex....@nationwidechildrens.org>
Subject: Re: [cbioportal] API query question

Heather it would be something like the following code, where the data variable is set to something like this. Note that for sampleIds and sampleListId, you only need to specify one. { "sampleIds": [ "string" ], "sampleListId":

ZjQcmQRYFpfptBannerStart

Costello, Heather

unread,
Mar 24, 2025, 8:01:10 AM3/24/25
to JJ Gao, Aaron L, cbiop...@googlegroups.com, Gao, JJ, Goar, Wes, Cannon, Matthew, Wagner, Alex

Hi JJ and Aaron,

 

Thank you Aaron, that was definitely helpful. Unfortunately, even using ChatGPT, I’m still having difficulty formatting my script to get the information I need.

 

Thank you JJ, I have actually already downloaded the pediatric datasets and explored them to a significant extent. We are updating a knowledge database to include peds cBioPortal data. Ideally, we’d like to access it programmatically to keep that flexibility for possible future expansion of the datasets/studies we are pulling.  

 

I have copied the project owner (Alex Wagner) and two scientists I am working with on this effort (Matthew Cannon and Wesley Goar) in case they would like to weigh in.

 

Best,

 

Heather Costello

 

From: JJ Gao <jianji...@gmail.com>
Date: Tuesday, March 18, 2025 at 10:26
AM
To: Aaron L <lisman...@gmail.com>
Cc: Costello, Heather <Heather....@nationwidechildrens.org>, cbiop...@googlegroups.com <cbiop...@googlegroups.com>, Gao, JJ <ga...@mskcc.org>
Subject: Re: [cbioportal] API query question

Hi Heather, Are you trying to test the API? Or are you getting the mutation data to test the import process for your local instance? If the latter, you can download the whole study - see screenshot below. Best, -JJ On Tue, Mar 18, 2025 at 8:09

ZjQcmQRYFpfptBannerStart

This Message Is From an Untrusted Sender

You have not previously corresponded with this sender.

Search “email warning banner” on ANCHOR for more information

 

ZjQcmQRYFpfptBannerEnd

Hi Heather,

 

Are you trying to test the API? Or are you getting the mutation data to test the import process for your local instance? If the latter, you can download the whole study - see screenshot below.

 

lisman...@gmail.com

unread,
Mar 25, 2025, 2:33:45 PM3/25/25
to cBioPortal for Cancer Genomics Discussion Group
Hi Heather, it's unclear if this thread is resolved.  Is there still an outstanding problem or can we close?
Reply all
Reply to author
Forward
0 new messages