필터 지우기
필터 지우기

EMBL RESTful API post request error

조회 수: 8 (최근 30일)
Sandrine
Sandrine 2020년 12월 27일
댓글: Sandrine 2020년 12월 27일
Hello,
I would like to post a request to the EMBL RESTful API (well known Bioinformatics database) to get data relative to two different IDs (as an example: ENSG00000157764 and ENSG00000248378) but I am encountering the following error:
server = 'https://rest.ensembl.org';
ext = '/lookup/id';
data = '{ "ids" : ["ENSG00000157764", "ENSG00000248378" ] }';
options = weboptions('ArrayFormat','json','MediaType','application/json','HeaderFields',{'Content-Type' 'application/json';'Accept' 'application/json'},'RequestMethod','post');
r = webwrite([server,ext],data, options);
Error using webwrite (line 136)
Internal error: "curl_multi_remove_handle" failed with CURLMcode API function called from
within callback.
I am able to run this request using Python 3 like in there:
As part of the BioInformatics toolbox there are functions (getembl, emblread) but I cannot get them to work either.
Maybe it is a syntax problem or an option that I did not specify. I'll be happy to submit the MATLAB version for their website.
Thank you very much for the help!
Sandrine

채택된 답변

Ive J
Ive J 2020년 12월 27일
You are almost there, except that MATLAB doesn't have a dictionary data type as Python3 has, so you should construct a struct instead:
getURL = 'https://rest.ensembl.org/lookup/id';
headers = {'Content-Type' 'application/json'; 'Accept' 'application/json'};
options = weboptions('RequestMethod', 'post', 'HeaderFields', headers, 'ArrayFormat', 'json');
data = struct('ids', ["ENSG00000157764", "ENSG00000248378"]);
r = webwrite(getURL, data, options)
struct with fields:
ENSG00000248378: [1×1 struct]
ENSG00000157764: [1×1 struct]

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Web Services에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by