Skip to content
Last updated

This example is a simple client application that uses Node.js to access the main API (REST). It will find all the available instruments, display the status of the first instrument, and then show all the measurements for today.

Tutorial

Step 1: Get the code from GitHub

  • Clone the code from this repository.
  • Or download the ZIP file and extract it.
  • Navigate to the Examples/Nodejs_Basic folder.
git clone https://github.com/CirrusResearch/MyCirrus.git
git checkout master
cd Examples/Nodejs_Basic

Step 2: Add your API key

  • Edit the index.js file and replace <YOUR_API_KEY> with your API key.

You can create an API key in the MyCirrus website. For more details see the Authentication guide.

const key = '<YOUR_API_KEY>' // Your API key

Step 3: Running the Example

  • Run npm install to install the dependencies.
  • Run node index.js to run the example.
EXAMPLE_OUTPUT

Summary

This example showed how to connect to the MyCirrus API using Node.js. It demonstrated how to make authenticated requests to the API, retrieve information about available instruments, and access measurement data.

You can modify the example to suit your needs, such as changing which instruments you query or how you process the retrieved data. For more information on the available API endpoints and data formats, refer to the API Reference section.