4

I am currently working with IBM's IOTP (Internet of Things Platform) services.
I was able to connect to IOTP and transmit data successfully.

Using the Watson IOT Platform web interface I was able to create some cloud rules and trigger some real time alerts too.

My question is, Is it possible to create cloud rules using RESTFul service or a CURL requests ? Is there any RESTFul service available for this purpose ?

ValerieLampkin
  • 2,620
  • 13
  • 27
gbids
  • 489
  • 1
  • 6
  • 16

2 Answers2

1

RTI exposed the following API to create rules.

POST {baseUrl}/rule
{
  "name": "Abnormal Power Usage",
  "description": "Abnormal Power Usage when exceeding 100",
  "disabled": false,
  "severity": 1,
  "schemaId": "f1b2b80f",
  "condition": ".reading > 100",
  "actions": [
    "cc899bdc"
  ]
}

It also allows creating actions.

POST {baseUrl}/action
Payload:
{
  "type": "node-red",
  "name": "Node-RED Webhook",
  "description": "A webhook for integrating with Node-RED",
  "fields": {
    "url": "http://btnodered.mybluemix.net/rti-webhook"
  }
}

Note that you have to create actions before creating a rule as you refer to the action in your rule.

Above example is taken from this article. It provides details.

However, RTI has been merged with IoTP recently and I'm not sure if IBM has exposed the above API from IoTP as of now. I will try to find this.

The base URL of IoTP APIs is as follows.

https://{6-letter-org_id}.internetofthings.ibmcloud.com/api/v0002/

Use basic authentication with username set to API key and password set to API token. Details of all IoTP APIs can be found here. Use

Dashboard -> Apps -> Generate Key

to create a pair of API key and token.

1

We can use IBM business rules service. (But this involve to include new service rather than directly using RTI api as mentioned by Chandana).

With Business Rules service on Bluemix, you can capture decisions in the form of business rules that are external to your applications.

You can easily modify the decisions without having code changes in the IoT application.

Refer http://www.ibm.com/developerworks/bpm/library/techarticles/1604_siddiqui-bluemix-trs/1604_siddiqui.html