GoodData | Developer Network

Channel Setup


Description

The resource for setting up new Channel for Subscription.

Request

HTTP Request

POST

https://secure.gooddata.com/gdc/account/profile/PROFILE_ID/channelConfigurations

HTTP Headers

Content-Type: application/json
Accept: application/json

Request Body

Following JSON payload should be sent to create a new Salesforce Chatter channel:

{
   "channelConfiguration":{
      "configuration":{
         "sfdcChatterConfiguration":{
            "username":"your@email",
            "password":"passwordSecurityToken"
         }
      },
      "meta":{
         "title":"SFDC Channel"
      }
   }
}

To create Twillio as a channel use following JSON payload:

{
   "channelConfiguration":{
      "configuration":{
         "twilioSmsConfiguration":{
            "username":"username",
            "password":"AUTH TOKEN",
            "from":"+14086457515",
            "to":"+420724000000"
         }
      },
      "meta":{
         "title":"Twilio Title"
      }
   }
}

To create Email as a channel use following JSON payload:

{
    "channelConfiguration": {
        "configuration": {
            "emailConfiguration": {
                "to": "user@email.com"
            }
        },
        "meta": {
            "title": "Email Channel"
        }
    }
}

Response

201 Created HTTP Status + URI + description of created channel configuration:

{
    "channelConfiguration": {
        "configuration": {
            "sfdcChatterConfiguration": {
                "username": "USERNAME@DOMAIN.COM"
            }
        },
        "meta": {
            "title": "Channel Name",
            "author": "/gdc/account/profile/PROFILE_ID_",
            "category": "channelConfiguration",
            "updated": "2011-12-20 13:43:17",
            "created": "2011-12-20 13:43:17",
            "uri": "/gdc/account/profile/PROFILE_ID/channelConfigurations/CHANNEL_ID"
        }
    }
}

Subscription Setup


Description

Resource for creating new Subscription based on specific JEXL expression.

Request

HTTP Request

POST

https://secure.gooddata.com/gdc/projects/PROJECT_ID/users/USER_ID/subscriptions

HTTP Headers

Content-Type: application/json
Accept: application/json

Request Body

Following JSON payload should be sent to create new Subscription (example):

{
   "subscription":{
      "triggers":[
         {
            "timerEvent":{
               "cronExpression":"0 0/5 * * * *"
            }
         }
      ],
      "condition":{
         "condition":{
            "expression":"f:executeMetric('METRIC_URI') < 16"
         }
      },
      "message":{
         "template":{
            "expression":"Average Chatter posts per Opportunity has fallen to ${f:executeMetric('METRIC_URI')} ..."
         }
      },
      "channels":[
         "CHANNEL_URI"
      ],
      "meta":{
         "title":"Avg Posts per Oppty < 16"
      }
   }
}

Response

201 Created HTTP Status + URI and details of created subscription:

{
    "subscription": {
        "triggers": [
            {
                "timerEvent": {
                    "cronExpression": "0 0/5 * * * *"
                }
            }
        ],
        "condition": {
            "condition": {
                "expression": "f:executeMetric('/gdc/md/PROJECT_ID/obj/OBJECT_ID') < 0.99"
            }
        },
        "message": {
            "template": {
                "expression": "Custom message % ${f:executeMetric('/gdc/md/PROJECT_ID/obj/OBJECT_ID')} ..."
            }
        },
        "channels": [
            "/gdc/account/profile/USER_ID/channelConfigurations/CHANNEL_ID"
        ],
        "meta": {
            "title": "TEST%",
            "author": "/gdc/account/profile/USER_ID",
            "category": "subscription",
            "updated": "2011-12-20 13:59:23",
            "created": "2011-12-20 13:59:23",
            "uri": "/gdc/projects/PROJECT_ID_/users/USER_ID_/subscriptions/SUBSCRIPTION_ID"
        }
    }
}