{"id":28214998,"url":"https://github.com/hakaiinstitute/hakai-api-client-matlab","last_synced_at":"2026-03-03T04:37:31.967Z","repository":{"id":86770192,"uuid":"136375119","full_name":"HakaiInstitute/hakai-api-client-matlab","owner":"HakaiInstitute","description":"Make authenticated requests for data to the Hakai API with Matlab","archived":false,"fork":false,"pushed_at":"2026-01-28T18:07:18.000Z","size":34,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":8,"default_branch":"master","last_synced_at":"2026-01-29T08:48:53.047Z","etag":null,"topics":["api","api-client","api-wrapper","eims","hakai","matlab","rest","rest-api"],"latest_commit_sha":null,"homepage":"","language":"MATLAB","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HakaiInstitute.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-06-06T19:11:39.000Z","updated_at":"2026-01-28T18:07:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"3d0334a7-5bf8-4f71-b0be-379b376e6cc6","html_url":"https://github.com/HakaiInstitute/hakai-api-client-matlab","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/HakaiInstitute/hakai-api-client-matlab","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HakaiInstitute%2Fhakai-api-client-matlab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HakaiInstitute%2Fhakai-api-client-matlab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HakaiInstitute%2Fhakai-api-client-matlab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HakaiInstitute%2Fhakai-api-client-matlab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HakaiInstitute","download_url":"https://codeload.github.com/HakaiInstitute/hakai-api-client-matlab/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HakaiInstitute%2Fhakai-api-client-matlab/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30032037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T03:27:35.548Z","status":"ssl_error","status_checked_at":"2026-03-03T03:27:09.213Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-client","api-wrapper","eims","hakai","matlab","rest","rest-api"],"created_at":"2025-05-17T21:08:51.640Z","updated_at":"2026-03-03T04:37:31.962Z","avatar_url":"https://github.com/HakaiInstitute.png","language":"MATLAB","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hakai Api Matlab Client\n\n# How to install this code\nClone this repo to the machine running Matlab. This can be your local machine or a server.\n```\ncd ~\ngit clone https://github.com/HakaiInstitute/hakai-api-client-matlab.git\n```\nCopy The Hakai package folder into your Matlab path or place it in the working directory of your project.\n```matlab\n% Add package +Hakai to your script\naddpath('[path-to-directory]/hakai-api-client-matlab');\n```\n\n# How to run/deploy this code\n\n```matlab\n% Get the api request client\nclient = Hakai.Client();\n\n% Make a data request for sampling stations\nurl = sprintf('%s/%s',client.api_root,'eims/views/output/chlorophyll?limit=20');\nresponse = client.get(url);\n\ndisp(url); % https://portal.hakai.org/api/eims/views/output/chlorophyll...\ndisp(response); % response will be a matlab 20x1 struct\ndisp(struct2table(response)); % convert struct to a table for easy viewing\n```\n\n# The URL where this code is deployed\n    On local user machines, likely not everywhere.\n    \n# Usage\n\n## Methods\n\nThis library exports the `Hakai` package with a single class named `Client`. Instantiating this class sets up the credentials for requests using the `get` or `post` methods.\n\nThe hakai_api `Client` class also contains a property `api_root` which is useful for constructing urls to access data from the API. The above [Quickstart example](#quickstart) demonstrates using this property to construct a url to access chlorophyll data.\n\nIf for some reason your credentials become corrupted and stop working, there is a method to remove the old cached credentials for your account so you can re-authenticate. Simply call the method like so `client.remove_old_credentials()`.\n\n## API endpoints\n\nFor details about the API, including available endpoints where data can be requested, see the [Hakai API documentation](https://github.com/HakaiInstitute/hakai-api).\n\n## Advanced usage\n\nYou can specify which API to access when instantiating the Client. By default, the API uses `https://portal.hakai.org/api` as the API root. It may be useful to use this library to access a locally running API instance or to access the Goose API for testing purposes.\n\nGoose and Hecate use the same tokens, so you can either instantiate the client using Goose as the API root, or use Goose when making the requests.\n\n```matlab\n% Get a client for Goose and make requests as usual\nclient = Hakai.Client('https://portaldev.hakai.org/api')\ndisp(client.api_root) % https://portaldev.hakai.org/api\nurl = sprintf('%s/%s',client.api_root,'eims/views/output/chlorophyll?limit=20');\nresponse = client.get(url);\n\n% Use Hecate client to access Goose\nclient = Hakai.Client();\ndisp(client.api_root) % https://portal.hakai.org/api\nurl = sprintf('%s/%s','https://portaldev.hakai.org/api','eims/views/output/chlorophyll?limit=20');\nresponse = client.get(url);\n```\n\nYou won't be able to create a localhost token, but you can instantiate a Goose or Hecate client and then use it to query a locally running API instance that has local auth disabled.\n\n```matlab\n% Use Hecate client to query locally running API instance\nclient = Hakai.Client();\nurl = sprintf('%s/%s','http://localhost:8666','eims/views/output/chlorophyll?limit=20');\n```\nTo post data method can be used to send data back to the Hakai api via MatLab through a specific endpoint. The post method also accept optional [weboptions](https://www.mathworks.com/help/matlab/ref/weboptions.html) inputs to define the format of the output sent.\n\n```matlab\nclient = Hakai.Client();\n\n# Load file in memory\nfid = fopen(path_to_pdf,'rb');\npdf_data = char(fread(fid)');\nfclose(fid);\n\nurl = sprintf('%s/ctd/process/rbr/s3/2_Processed_%d',client.api_root,meta.ctd_cast_pk);\n\nresponse = client.post(url, pdf_data,...\n    'MediaType', 'application/octet-stream',...\n    'CharacterEncoding','ISO-8859-1',...\n    'ContentType', 'raw'...\n);\n```\n\n### Author\n\nMatthew Foster(matthew.foster@hakai.org)\n\nCopyright (c) 2017 Hakai Institute and individual contributors All Rights Reserved.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhakaiinstitute%2Fhakai-api-client-matlab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhakaiinstitute%2Fhakai-api-client-matlab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhakaiinstitute%2Fhakai-api-client-matlab/lists"}