Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
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
minLevel1
maxLevel2
outlinefalse
typelist
separatorbrackets
printablefalse

...

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

See https://heuristicsolutions.atlassian.net/wiki/spaces/DOCS/pages/3697770890/Learning+Hub#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

ProgramId

string (25 char)

The identifier of the Subscriber

PublisherProgramId

string (25 char)

The identifier of the Publisher

LastSyncUtc

UTC date/time

UTC timestamp of the last time the Subscriber pulled data from this Publisher

SyncEnabled

boolean

Whether or not the subscription supports the nightly sync process. (Applies to LearningBuilder subscribers Subscribers only)

Note

Setting this to TRUE does not automatically enable the nightly sync, it just allows the nightly sync to process this subscription.

LbApiPayloadTemplate

JSON

JSON structure mapping different PublisherEventCategory values to the Handlebars template that converts those Events into a batch row payload for LearningBuilder’s WorkflowImportQueue/CreateBatch API.

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.

...

  • 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 LbApiPayloadTemplate

Subscribe to all publisher Publisher event categories, using the same template for everything

Code Block
languagejson
"LbApiPayloadTemplate": {
  "_default": {
    "action": "import",
    "label": "Import everything",
    "importProcessId": {WIQ Process Id},
    "batchRowTemplate": "{handlebars template}"
  }
}

Subscribe to all publisher Publisher event data, with special handling for a specific category

Code Block
languagejson
"LbApiPayloadTemplate": {
  "COURSEsome_key": {
    "action": "import",
    "label": "ACME Course",
    "importProcessId": {WIQ Process Id},
    "batchRowTemplate": "{handlebars template}"
  },
  "_default": {
    "action": "import",
    "label": "Import everything",
    "importProcessId": {WIQ Process Id},
    "batchRowTemplate": "{handlebars template}"
  }
}

Subscribe to a specific category only, ignoring everything else

Code Block
languagejson
"LbApiPayloadTemplate": {
  "COURSE": {
    "action": "import",
    "label": "ACME course",
    "importProcessId": {WIQ Process Id},
    "batchRowTemplate": "{handlebars template}"
  },
  "_default": {
    "action": "ignore",
    "label": "Nothing else matters"
  }
}

Ignore a specific category, process everything else using a common template

Code Block
languagejson
"LbApiPayloadTemplate": {
  "SOME_CATEGORY": {
    "action": "ignore",
    "label": "ACME course"
  },
  "_default": {
    "action": "import",
    "importProcessId": {WIQ Process Id},
    "batchRowTemplate": "{handlebars template}"
  }
}

...

  • 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 specific PublisherEventCategory 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)

Code Block
languagejson
[
  { 
    "ProgramId": "subscriber_program_id", 
    "PublisherProgramId": "publisher_program_id", 
    "CreatedUtc": "UTC date/time",
    "LastSyncUtc": "UTC date/time",
    "SynEnabled": true,
    "LbApiPayloadTemplate": {
      "SOME_CATEGORY": {
        "action": "import",
        "label": "ACME Course",
        "importProcessId": {WIQ Process Id},
        "batchRowTemplate": "{handlebars template}"
      }
    }    
  },
  ...
]

...

GET /api/programs/{programId}/eventSubs/{

...

publisherProgramId}
Handy status macro
set36399
isLabeledfalse
historySnapshotId7cfb151d-d309-448c-9e11-ef4dcd1953cc
status185953
historyChainId995d84a4-485f-470b-9882-e5f4d573912a

Info

Returns the details about {programId}'s subscription to {publisherIdpublisherProgramId}'s Events.

Responses

Response Code

Headers and Body

200 (Ok)

Code Block
languagejson
{ 
  "ProgramId": "foo", 
  "PublisherProgramId": "bar", 
  "CreatedUtc": "UTC date/time",
  "LastSyncUtc": "UTC date/time",
  "SynEnabled": true,
  "LbApiPayloadTemplate": { see docs above }  
}

...

Code Block
{
  "PublisherProgramId": "PublisherIdPublisherProgramId",
  "SyncEnabled": true,
  "LbApiPayloadTemplate": {
    "SOME_CATEGORY": {
      "action": "import",
      "label": "ACME Course",
      "importProcessId": {WIQ Process Id},
      "batchRowTemplate": "{handlebars template}"
    }
  }    
}

...

Response Code

Headers and Body

201 (Created)

A new Event Subscription was created. No body is returned.

HTTP headers:

Location: /API/programs/{programId}/eventSubs/{pubProgId}

...

PATCH /api/programs/{programId}/eventSubs/{

...

publisherProgramId}
Handy status macro
set36399
isLabeledfalse
historySnapshotId7cfb151d-d309-448c-9e11-ef4dcd1953cc
status185953
historyChainId995d84a4-485f-470b-9882-e5f4d573912a

Info

Updates an existing Event Subscription.

...

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
set36399
isLabeledfalse
historySnapshotId7cfb151d-d309-448c-9e11-ef4dcd1953cc
status185953
historyChainId995d84a4-485f-470b-9882-e5f4d573912a

Info

Deletes an existing Event Subscription.

...