Usage Example in MATLAB®
An example written in MATLAB® should provide the user with the necessary tools to get started with using the API. The following sections walk you through the process to authenticate with the API and request raw telemetry data.
For the example to work some constants need to be defined to work with later on.
Don't forget to set the
imo_number constant to the IMO number of the ship you want to query data for.
imo_number = '1234567'
api_url = 'https://api.hoppe-sts.com/';
api_key = getenv('STS_API_KEY');
The API key is retrieved from the environment variable
Authentication and authorization is handled via an API key. Please consult the Getting Started page for details about the API key creation.
The time series API requires the Data Butler Quality package.
With this API key at hand we can proceed to (for example) request time series signals for a specified ship in a given time period:
header_fields = ["Authorization", strcat("ApiKey ", api_key)];
data_call_options = weboptions('ContentType', 'json', ...
'MediaType', 'application/json', ...
'HeaderFields', header_fields, ...
time_series_data = webread(strcat(api_url, 'ships/', imo_number, '/data/series'), data_call_options);
This example should get you easily started with using MATLAB® to access your data in the cloud.
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See mathworks.com/trademarks for a list of additional trademarks.
Please always treat each API key as secret and do not share it with any unauthorized persons. An API key allows access to some of your most valuable assets: your data.