Clear Filters
Clear Filters

Chemicalize REST/API not working

5 views (last 30 days)
Camila Carvalho
Camila Carvalho on 27 Jul 2020
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);

Answers (0)

Categories

Find more on Chemistry in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!