Developer Documentation
  • Introduction
  • Recipes
    • Using Recipes with Lingk APIs
  • Lingk REST APIs
    • Using Postman with Lingk APIs
    • Events & Webhooks
    • Code Samples
      • C#
      • ColdFusion
      • Go
      • Java
      • Node.js
      • PHP
      • Python
      • Salesforce Apex
  • API Explorer
  • API Plugin for Apache Nifi
    • Docker on Windows Installation Guide
    • Colleague Implementation Notes
    • Testing the API Plugin with Postman
Powered by GitBook
On this page
  • Create a subscription
  • Delete a subscription
  • Get subscriptions
  • Post an event
  • Consume Events via a Webhook

Was this helpful?

  1. Lingk REST APIs

Events & Webhooks

PreviousUsing Postman with Lingk APIsNextCode Samples

Last updated 5 years ago

Was this helpful?

Lingk moves your periodic, scheduled integration processes to data-driven events that fit into your business process. Lingk's Event Broker connects real-time data and events with monitoring, analysis, communication, and learning systems.

Here are a few scenarios:

  • A Lingk real-time recipe is triggered based on a learning event consumed by another HTTP endpoint.

  • As files are transformed, an error occurs due to a schema change in the file. In real-time, a specific event that is subscribed to by a email notification engine and the bug tracking system is created.

  • As education data is transformed by the Transformer Engine, events are added to queues for grading, retention, and alerting purposes.

To see an example Node.js project go to:

Create a subscription

curl -X POST  
-H "date: Wed, 27 Jul 2016 02:38:11 UTC"  
-H 'Authorization: Signature keyId="asfsdfaf",algorithm="hmac-sha1",headers="date (request-target)",signature="WCIW%2F%2B0WG8tIvpQ0W7t34kksj5Q%3D"' 
-d @subscription.json
https://www.lingkapis.com/v1/@self/webhooks/subscriptions

{
 "tenantKeyFilter": "lingkuni",
 "appKeyFilter": "peoplesoftsis",
 "objectTypeFilter": "*",
 "verbFilter": "*",
 "deliveryUrl": "http://some.lingkto.com/test/webhookdelivery"
}

Delete a subscription

curl -X DELETE  
-H "date: Wed, 27 Jul 2016 02:39:44 UTC"  
-H 'Authorization: Signature keyId="dfsadfasf",algorithm="hmac-sha1",headers="date (request-target)",signature="wBRwzLuW%2BCXblCFEJtjO9YSjXgw%3D"' 
https://www.lingkapis.com/v1/@self/webhooks/subscriptions/e029485bf8ba4c6ba11b2a62ec208af7

Get subscriptions

curl -X GET  
-H "date: Wed, 27 Jul 2016 02:41:42 UTC"  
-H 'Authorization: Signature keyId="dfsadfasf",algorithm="hmac-sha1",headers="date (request-target)",signature="oDEh0diKNuzzHSBYXW3tAVywd0g%3D"' 
https://www.lingkapis.com/v1/@self/webhooks/subscriptions

Post an event

curl -X POST  
-H "date: Wed, 27 Jul 2016 02:43:21 UTC"  
-H 'Authorization: Signature keyId="dfsadfasf",algorithm="hmac-sha1",headers="date (request-target)",signature="V3dgtmkNLvxq7QNPx4kXcSuFU0k%3D"' 
-d @event.json https://www.lingkapis.com/v1/@self/events

 {
    "verb":"create",
    "objectType":"fileUpload",
    "eventObject": { "file":
      { "path": "/path.zip" } 
    }
}

 {
    "verb":"add",
    "objectType":"learningEvent",
    "eventObject": { 
    ... Capliper/xAPI statement ...
    }
}

Consume Events via a Webhook

After an event is triggered through the Event Broker, all subscribed endpoints are pushed a JSON payload for the event.

The eventObject property contains the data associated with the event. Lingk has a specific eventObject format for files imported into a Data Repository.

Example Webhook Payload

{
  "appKey": "courserosters",
  "eventGuid": "538c8a6e2e44477a84e85dbeb921bef9",
  "eventObject": {
    "course": {
      "courseCode": "24617.1101"
    }
  },
  "objectType": "integration.courserosters.testevent",
  "tenantKey": "integration",
  "timestamp": "2016-10-21T06:11:40.267817769Z",
  "verb": "finish"
}
https://github.com/lingkio/event-triggered-recipe-nodejs