SAP Cloud Platform Open Connectors

Triggering Events

To kick off an event, you generally need to do something in the service. Here, we'll make a POST /folders request to create a new folder, and expect to get a notification:

  • HTTP Headers: Authorization- User <user secret>, Organization <organization secret>
  • HTTP Verb: POST
  • Request URL: /folders
  • Request Body: Required – see below
  • Query Parameters: None
  curl -X POST \
  -H 'Authorization: User <INSERT_USER_SECRET>, Element <INSERT_ELEMENT_SECRET>' \
  -H 'Content-Type: application/json' \
  -d @TestFolderCreate.json \
  'https://api.openconnectors.us2.ext.hana.ondemand.com/elements/api-v2/hubs/documents/folders?path=/testfoldercreate'

with the following in TestFolderCreate.json:

 {
  "path": "/testfoldercreate",
  "tags": [
    "TestFolderCreate"
  ],
  "createdDate": "",
  "size": 0,
  "name": "TestFolderCreate",
  "directory": false
}

Once that's done, we would expect to eventually see the following webhook content made to the endpoint we specified in the instance's "event.notification.callback.url" configuration ( http://my-cool-site/callback in our example):

{
  "eventId": 1088,
  "instanceId": 31,
  "response": {
    "events": [
      {
        "path": "/testfoldercreate",
        "metadata": {
          "path": "/TestFolderCreate",
          "name": "TestFolderCreate",
          "type": "folder"
        }
      }
    ]
  },
  "notificationId": 1047
}

Note that any change made on the service end will trigger a notification, not just changes initiated from SAP Cloud Platform Open Connectors. In this example, if a user of this Dropbox account were to add a folder via the Dropbox Web UI, then a webhook would still be delivered to the instance's callback URL.