フィルターのクリア

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]
  1 件のコメント
Sandrine
Sandrine 2020 年 12 月 27 日
Thank you so much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWeb Services についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by