Skip to main content

Incremental sync

Assignments, enrollments and attempts have an updatedAt filter field, and their lists sort on updatedAt. Use it to read only the records that changed since your last run.
  1. On the first run, read every page with order=asc and limit=100. Do not send a filter.
  2. Upsert each record into your system by its id.
  3. Store the largest updatedAt value that you received.
  4. On the next run, subtract a few minutes from the stored value.
  5. Read every page with the filter updatedAt >= timestamp("<that time>"), order=asc and limit=100.
  6. Upsert each record by its id, and store the new largest updatedAt.
Step 4 re-reads a short overlap, so that you do not miss a record that was written at the same moment as your last run. Because you upsert by id, a record that you read twice does no harm. Use limit=100 for a sync. It needs the fewest requests, so it stays well inside the rate limits. An assignment’s updatedAt also moves when its simulations change, so this sync finds a change to simulationIds.

Enrollments

Sync enrollments with the steps above on GET /v2/enrollments. One list holds every enrollment in your workspace, so store one updatedAt value for the whole list. If you sync each assignment with GET /v2/assignments/{id}/enrollments, that list continues to work. The rows are the same. An enrollment’s updatedAt is the time when the learner’s progress last changed: their status, score or number of submitted items. It is not the time when the record was written.

Attempts

Sync attempts with the steps above on GET /v2/attempts. One list holds every attempt in your workspace, so store one updatedAt value for the whole list. An attempt’s updatedAt is the time when its result last changed: its status, score, section scores, scorecard version, positives, negatives or passed. A reviewer’s correction to a score moves updatedAt but not scoredAt, so sync on updatedAt. To read the attempts for one enrollment, filter on enrollmentId. Lists never include transcripts. To store them, read Get an attempt transcript for each role-play once it has a scoredAt, or a final status if it is never scored. You do not need to read it again after that. Each read counts against your rate limit.

Scorecards

Sync scorecards with the steps above on GET /v2/scorecards. A deleted scorecard stays in the list with archived set to true, so it does not appear in GET /v2/deletions. Publishing a version moves the scorecard’s updatedAt. A published version does not change, so when a scorecard’s updatedAt moves, read GET /v2/scorecards/{id}/versions and store the versions that you do not have. To follow one section across versions, use its sectionId.

Records that change while you read

With order=asc, a record that changes during your sync gets a later updatedAt. It moves to the end of the list, and you read it again on a later page. No other record is skipped.

People

The people list sorts on createdAt, and it has no updatedAt filter. A filter on createdAt finds new members only, not changes to existing ones. To keep people current, read the full list on each run and upsert by id.

Groups

A removed group is not in GET /v2/deletions, and a change to a group’s members or leads does not move its updatedAt. To keep groups current, read GET /v2/groups in full on each run, then read the members and leads of each group. Replace the rows that you hold for a group with the rows that you read.

Removed records

A removed record drops out of its list, so the steps above never see it go. Read GET /v2/deletions on each run to find assignments, enrollments, attempts, people and simulations that were removed.
  1. On the first run, read every page with order=asc and limit=100. Do not send a filter.
  2. Delete each record from your system by its object and id.
  3. Store the largest deletedAt value that you received.
  4. On the next run, subtract a few minutes from the stored value, and read every page with the filter deletedAt >= timestamp("<that time>").
Read deletions before you read the lists. A record that was removed and then came back is in its list again, so reading the list puts it back in your system. Applying a deletion twice does no harm.

GET /v2/deletions

Scope: any one of assignments:read, attempts:read, people:read and simulations:read. The list sorts on deletedAt, most recent first. Send order=asc for oldest first, which is the order a sync uses. A key sees only the kinds of record that its scopes can read: When an assignment is deleted, the list has one row for the assignment and one row for each of its enrollments. These rows have the same deletedAt. The attempts stay, and enrollmentId on them does not change. The list leaves out:
  • A record that came back. When a person rejoins or a learner is enrolled again, the same record and ID return to their list. A learner who is enrolled again has a later updatedAt. A person who rejoins has a later createdAt, and their updatedAt might not change.
  • Attempts and simulations that version 2 never served, such as hiring candidates’ attempts, hiring simulations, simulations shared across workspaces and previews.
  • Groups, group memberships and scorecards.
A row can name a record that you never held, such as one made and removed between two of your runs. Ignore it.

Query parameters

Read Lists for how the parameters work.

Filter fields

Response

id is the ID that version 2 sent for the record, and its prefix matches object.

Errors

Read Errors for every code.