API Docs
Integrations
Operational has a official node.js SDK.
For other languages, you can use our REST Api.
To get started with our sdk, run this inside your project:
npm install --save @operational.co/sdk
CopyAuthentication
You will need a valid api key to use Operational.
To do so, create an account at app.operational.co
Then copy the api key from app.operational.co/profile/apikeys and pass it as the first parameter in the SDK or as a bearer token if using the REST api.
Example:
import Operational from "@operational.co/sdk";
// Or use this if imports are not supported in your node.js version
// const Operational = require("@operational.co/sdk");
const ops = new Operational("yourapikey");
Copyconst bearerToken = 'Bearer apikey';
const baseUrl = 'https://api.operational.co';
const url = `api/${this.version}/log`;
const event = {
name: "test event"
};
fetch(`${baseUrl}/${url}`, {
method: 'POST',
headers: {
'Authorization': bearerToken,
'Content-Type': 'application/json'
},
body: JSON.stringify(event)
})
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
console.log('Success:', data);
})
.catch(error => {
console.error('Error:', error);
});
Copy