Chemicalize REST/API not working

5 次查看(过去 30 天)
Camila Carvalho
Camila Carvalho 2020-7-27
I'm trying to use MATLAB to get chemical information about multiple compounds using the Chemicalize REST API. I have a PRO account, but everytime I try to use the code, it keeps giving me this error:
Error using matlab.internal.webservices.HTTPConnector/copyContentToByteArray (line 396)
The server returned the status 401 with message "" in response to the request to URL
https://api.chemicalize.com/v1/calculate/aspirin.
Error in readContentFromWebService (line 46)
byteArray = copyContentToByteArray(connection);
Error in webwrite (line 139)
[varargout{1:nargout}] = readContentFromWebService(connection, options);
Error in smilestocheminfo (line 5)
z = webwrite(url, options);
Am I doing something wrong? It says on the website that, for evaluation purposes, the molecule 'aspirin' should not require a subscription, so I don't know how to do this.
The code I'm using is:
clear; clc
api = 'https://api.chemicalize.com/v1/';
url = [api 'calculate/aspirin'];
options = weboptions('Username','myusername','Password','mypassword');
z = webwrite(url, options);
S = webread(z);

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Chemistry 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by