Info |
---|
Although these APIs are publicly documented, the management of Event Subscriptions is currently handled by Heuristics staff due to the complex templating that is involvedAs of the 12.4 release, Event Subscriptions are editable through LearningBuilder for LearningBuilder Subscribers. |
Table of Contents | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
Subscribers must “subscribe” to a Program in order to pull its data from the Hub. The Publisher’s data are not publicly accessible to prevent it from being scraped, and to give Publishers controls over their data.
Heuristics staff establish these relationships partially to manage the complex templates that are required, but also to ensure that the Subscriber has a legitimate need to access that Publisher’s data.
API Hostnames
...
SUBSCRIPTION | ||||
---|---|---|---|---|
A Subscription is a relationship from a Subscriber to a Publisher that allows the Subscriber to receive the Publisher’s data. | ||||
Field | Type | Notes | ||
| string (25 char) | The identifier of the Subscriber | ||
| string (25 char) | The identifier of the Publisher | ||
| UTC date/time | UTC timestamp of the last time the Subscriber pulled data from this Publisher | ||
| boolean | Whether or not the subscription supports the nightly sync process. (Applies to LearningBuilder subscribers Subscribers only)
| ||
| JSON | JSON structure mapping different See below for detailed explanation |
...
This section applies specifically to subscribers Subscribers using LearningBuilder. Other systems will need to implement their own mechanism for processing data from the Hub.
Publishers and Subscribers think about and model their data differently, so the publisher’s Publisher’s data typically needs modified or converted before it can be imported into LearningBuilder.
...
Code Block | ||
---|---|---|
| ||
"LbApiPayloadTemplate": { "{EventCategory1}": { "action": "import (default) | ignore", "label": "human readable note", "importProcessId": {WIQ Process Id}, "batchRowTemplate": "{handlebars template}" }, // ... additional category mappings as needed ... "*_default": { "action": "import (default) | ignore", "label": "human readable note", "importProcessId": {WIQ Process Id}, "batchRowTemplate": "{handlebars template}" } } |
Each key within the LbApiPayloadTemplate
should match one of the Publisher’s PublisherEventCategory
values, or the special marker “*_default
” which indicates a default template.
...
To import it into the Subscriber, using the specified
batchRowTemplate
To ignore it, because the Subscriber isn’t interested in that category of publisher Publisher data
Syntax examples
Example / scenario | Sample | |||||
---|---|---|---|---|---|---|
Subscribe to all publisher Publisher event categories, using the same template for everything |
| |||||
Subscribe to all publisher Publisher event data, with special handling for a specific category |
| |||||
Subscribe to a specific category only, ignoring everything else |
| |||||
Ignore a specific category, process everything else using a common template |
|
Omitting the “_default
” mapping has the same result as setting it to "action": "ignore"
, but it is recommended to explicitly include the default mapping to make the configuration easier to understand.
Detailed data flow
It works like this:
When Publishers push data into the Hub, they specify a
PublisherEventCategory
value. (For example, this might differentiate between data representing a completed course and data representing work history)A Subscriber’s
EventSubscription
contain contain one or more templates, each one mapped to a specificPublisherEventCategory
value. (This allows the subscriber Subscriber to convert those courses and work history entries in different ways)Each template converts a single
PublisherEventData
JSON object into a different JSON schema that can be passed to the Subscriber’s API/WorkflowImportQueue/CreateBatch API endpoint.When LearningBuilder synchronizes data, it loops through each
PublisherEventData
item, converts it using the relevant template, and then makes a single call to API/WorkflowImportQueue/CreateBatch to import the data.
...
Response Code | Headers and Body | |||||
---|---|---|---|---|---|---|
200 (Ok) |
|
...
GET /api/programs/{programId}/eventSubs/{
...
publisherProgramId}
Handy status macro | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Info |
---|
Returns the details about |
Responses
Response Code | Headers and Body | |||||
---|---|---|---|---|---|---|
200 (Ok) |
|
...
POST /api/programs/{programId}/eventSubs
Handy status macro | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Info |
---|
Creates a new Event Subscription. Returns an error if it already exists. Audit fields such as |
JSON Payload
Code Block |
---|
{ "PublisherProgramId": "PublisherProgramId"PublisherProgramId", "SyncEnabled": true, "LbApiPayloadTemplate": { "SOME_CATEGORY": { "action": "import", "label": "PublisherIdACME Course", "SyncEnabledimportProcessId": true {WIQ Process Id}, "LbApiPayloadTemplatebatchRowTemplate": "{handlebars "... (see docs above) ..."template}" } } } |
Responses
Response Code | Headers and Body |
---|---|
201 (Created) | A new Event Subscription was created. No body is returned. HTTP headers:
|
...
PATCH /api/programs/{programId}/eventSubs/{
...
publisherProgramId}
Handy status macro | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Info |
---|
Updates an existing Event Subscription. |
...
Code Block |
---|
{ "LastSyncUtc": "date", "SyncEnabled": true, "LbApiPayloadTemplate": "...{ (see docs above) ..." } } |
Responses
Response Code | Headers and Body |
---|---|
204 (No Content) | Update was performed successfully. No body is returned. |
...
DELETE /api/programs/{programId}/eventSubs/{
...
publisherProgramId}
Handy status macro | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Info |
---|
Deletes an existing Event Subscription. |
...