forked from plotly/plotly_matlab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakecall.m
More file actions
34 lines (27 loc) · 1.08 KB
/
makecall.m
File metadata and controls
34 lines (27 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function st = makecall(args, origin, structargs)
% check if signed in and grab username, key, domain
[un, key, domain] = signin;
if isempty(un) || isempty(key)
error('Plotly:CredentialsNotFound',...
['It looks like you haven''t set up your plotly '...
'account credentials yet.\nTo get started, save your '...
'plotly username and API key by calling:\n'...
'>>> saveplotlycredentials(username, api_key)\n\n'...
'For more help, see https://plot.ly/MATLAB or contact '...
'chris@plot.ly.']);
end
platform = 'MATLAB';
args = m2json(args);
kwargs = m2json(structargs);
url = [domain '/clientresp'];
payload = {'platform', platform, 'version', plotly_version, 'args', args, 'un', un, 'key', key, 'origin', origin, 'kwargs', kwargs};
if (is_octave)
% use octave super_powers
resp = urlread(url, 'post', payload);
else
% do it matlab way
resp = urlread(url, 'Post', payload);
end
st = loadjson(resp);
response_handler(resp);
end