Search code examples
tin-can-apilrslearning-locker

Can we update the data that have been sent already in the xApi


Initially I have done a post request for xApi containing some values(Score) under the verb.After successful api call it returns a token.

enter image description here

My question is can we update the same value(Score)? enter image description here If we can, please let me know.....!!!


Solution

  • Generally the answer is, no. xAPI Statement data is intended to be immutable. But in so far as it is a stream of data it is really up to the statement consumer to indicate how values can change for its purposes. So there are a couple of ways to achieve the same concept...

    1) Depending on the consuming system it may be as easy as just sending another statement with the new score. Some consuming systems will see the new score (generally for the same Activity, object, and/or registration) and consider it an update. In this case there will be multiple statements indicating a score, but based on timestamp we can know which was the last score received.

    2) The other way that is more akin to an "update" or an "edit" is to indicate that the original statement should have never existed in the first place by voiding it. Voiding a statement effectively takes it out of the stream of data so that the consuming system shouldn't consider it to have ever existed. After voiding you would then send a new statement with the updated score and likely keeping everything else the same, particularly the timestamp value. It is important to realize that simpler systems (such as those described in #1) may not handle the voiding case correctly as we've seen relatively little use of it in the wild (to date). Additionally it can be important to understand the nuance of the differences between the timestamp and stored property values and the order in which the consuming systems will process the data. For more on voiding see: https://www.ht2labs.com/void-xapi-statement/