Skip to content

Latest commit

 

History

History
executable file
·
222 lines (148 loc) · 5.22 KB

RulesApi.md

File metadata and controls

executable file
·
222 lines (148 loc) · 5.22 KB

ArtikCloud.RulesApi

All URIs are relative to https://api.artik.cloud/v1.1

Method HTTP request Description
createRule POST /rules Create Rule
deleteRule DELETE /rules/{ruleId} Delete Rule
getRule GET /rules/{ruleId} Get Rule
updateRule PUT /rules/{ruleId} Update Rule

createRule

RuleEnvelope createRule(ruleInfo, userId)

Create Rule

Create a new Rule

Example

var ArtikCloud = require('artikcloud-js');
var defaultClient = ArtikCloud.ApiClient.default;

// Configure OAuth2 access token for authorization: artikcloud_oauth
var artikcloud_oauth = defaultClient.authentications['artikcloud_oauth'];
artikcloud_oauth.accessToken = "YOUR ACCESS TOKEN"

var apiInstance = new ArtikCloud.RulesApi()

var ruleInfo = new ArtikCloud.RuleCreationInfo(); // {RuleCreationInfo} Rule object that needs to be added

var userId = "userId_example"; // {String} User ID


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.createRule(ruleInfo, userId, callback);

Parameters

Name Type Description Notes
ruleInfo RuleCreationInfo Rule object that needs to be added
userId String User ID

Return type

RuleEnvelope

Authorization

artikcloud_oauth

HTTP reuqest headers

  • Content-Type: Not defined
  • Accept: application/json

deleteRule

RuleEnvelope deleteRule(ruleId)

Delete Rule

Delete a Rule

Example

var ArtikCloud = require('artikcloud-js');
var defaultClient = ArtikCloud.ApiClient.default;

// Configure OAuth2 access token for authorization: artikcloud_oauth
var artikcloud_oauth = defaultClient.authentications['artikcloud_oauth'];
artikcloud_oauth.accessToken = "YOUR ACCESS TOKEN"

var apiInstance = new ArtikCloud.RulesApi()

var ruleId = "ruleId_example"; // {String} Rule ID.


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.deleteRule(ruleId, callback);

Parameters

Name Type Description Notes
ruleId String Rule ID.

Return type

RuleEnvelope

Authorization

artikcloud_oauth

HTTP reuqest headers

  • Content-Type: Not defined
  • Accept: application/json

getRule

RuleEnvelope getRule(ruleId)

Get Rule

Get a rule using the Rule ID

Example

var ArtikCloud = require('artikcloud-js');
var defaultClient = ArtikCloud.ApiClient.default;

// Configure OAuth2 access token for authorization: artikcloud_oauth
var artikcloud_oauth = defaultClient.authentications['artikcloud_oauth'];
artikcloud_oauth.accessToken = "YOUR ACCESS TOKEN"

var apiInstance = new ArtikCloud.RulesApi()

var ruleId = "ruleId_example"; // {String} Rule ID.


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getRule(ruleId, callback);

Parameters

Name Type Description Notes
ruleId String Rule ID.

Return type

RuleEnvelope

Authorization

artikcloud_oauth

HTTP reuqest headers

  • Content-Type: Not defined
  • Accept: application/json

updateRule

RuleEnvelope updateRule(ruleId, ruleInfo)

Update Rule

Update an existing Rule

Example

var ArtikCloud = require('artikcloud-js');
var defaultClient = ArtikCloud.ApiClient.default;

// Configure OAuth2 access token for authorization: artikcloud_oauth
var artikcloud_oauth = defaultClient.authentications['artikcloud_oauth'];
artikcloud_oauth.accessToken = "YOUR ACCESS TOKEN"

var apiInstance = new ArtikCloud.RulesApi()

var ruleId = "ruleId_example"; // {String} Rule ID.

var ruleInfo = new ArtikCloud.RuleUpdateInfo(); // {RuleUpdateInfo} Rule object that needs to be updated


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.updateRule(ruleId, ruleInfo, callback);

Parameters

Name Type Description Notes
ruleId String Rule ID.
ruleInfo RuleUpdateInfo Rule object that needs to be updated

Return type

RuleEnvelope

Authorization

artikcloud_oauth

HTTP reuqest headers

  • Content-Type: Not defined
  • Accept: application/json