I am using a data acquisition module with a web server. I would like to Post a run command to start an acquisition. Below are my commands with the error response.
>> s_sch = 'http://webdaq316-ae.local/api/v1.0/schedule/status/';
>> options = weboptions('ContentType','json','MediaType','application/json','RequestMethod','post','ArrayFormat','json')
options =
weboptions with properties:
CharacterEncoding: 'auto'
UserAgent: 'MATLAB 9.5.0.944444 (R2018b)'
Timeout: 5
Username: ''
Password: ''
KeyName: ''
KeyValue: ''
ContentType: 'json'
ContentReader: []
MediaType: 'application/json'
RequestMethod: 'post'
ArrayFormat: 'json'
HeaderFields: []
CertificateFilename: 'C:\Program Files\MATLAB\R2018b\sys\certificates\ca\rootcerts.pem'
>> apikey = 'True'
apikey =
'True'
>> json_command = ['{"run": ', apikey,'}']
json_command =
'{"run": True}'
>> start_sch = webwrite(s_sch,json_command, options)
However, I get the following error.
Error using readContentFromWebService (line 46)
The server returned the status 415 with message "" in response to the request to URL
http://webdaq316-ae.local/api/v1.0/schedule/status/.
Error in webwrite (line 139)
[varargout{1:nargout}] = readContentFromWebService(connection, options);