如何构造HTTP GET请求来过滤JSON响应



我正在用Curl发出以下HTTP GET请求:

卷曲http://rest.ensembl.org/variation/human/rs56116432?content-type=应用

它返回以下JSON对象:

{"source":"Variants (including SNPs and indels) imported from dbSNP","mappings":[{"location":"9:133256042-133256042","assembly_name":"GRCh38","end":133256042,"seq_region_name":"9","strand":1,"coord_system":"chromosome","allele_string":"C/T","start":133256042},{"location":"CHR_HG2030_PATCH:133256189-133256189","assembly_name":"GRCh38","end":133256189,"seq_region_name":"CHR_HG2030_PATCH","strand":-1,"coord_system":"chromosome","allele_string":"C/T","start":133256189}],"name":"rs56116432","MAF":"0.00259585","ambiguity":"Y","var_class":"SNP","synonyms":[],"evidence":["Multiple_observations","Frequency","1000Genomes","ESP","ExAC"],"ancestral_allele":"C","minor_allele":"T","most_severe_consequence":"missense_variant"

是否可以构造HTTP请求,以便在返回请求后只向浏览器返回密钥"most_severe_consequence"的值,而不是过滤数据?

API文档中没有包含特定的示例。

您可以添加一个查询参数,其中需要响应的组件。

例如。http://rest.ensembl.org/variation/human/rs56116432?content-type=应用程序;bit_i_care_about=最严重序列

或者,如果你知道你只想要一个字段,你可以有一个额外的路径元素。。。。

http://rest.ensembl.org/variation/human/rs56116432/mostrongevere_consequence?content-type=应用程序

最新更新