Skip to content
Advertisement

How to add optional parameters in REST API?

I am using the following REST API: https://rest.ensembl.org/documentation/info/vep_hgvs_get

An example of the code for this is as follows:

server = "https://rest.ensembl.org"
ext = "/vep/human/hgvs/ENSP00000401091.1:p.Tyr124Cys?"
r = requests.get(server+ext, headers={ "Content-Type" : "application/json"})

On the documentation page, it says it has an optional parameter as follows:

Name Description Example Values
dbNSFP Include fields from dbNSFP, a database of pathogenicity predictions for missense variants. Multiple fields should be separated by commas. See dbNSFP README for field list. (plugin details) LRT_pred,MutationTaster_pred

Does anyone know how I would incorporate the dbNSFP value into this REST API query?

Advertisement

Answer

You can by using params

e.g.

server = "https://rest.ensembl.org"
ext = "/vep/human/hgvs/ENSP00000401091.1:p.Tyr124Cys?"
params = {"dbNSFP": "LRT_pred"}
r = requests.get(server+ext, params=params, headers={ "Content-Type" : "application/json"})
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement