Skip to content

Instantly share code, notes, and snippets.

@ryasmi
Last active April 12, 2018 14:38
Show Gist options
  • Save ryasmi/066d3e52ff48d65b7f25 to your computer and use it in GitHub Desktop.
Save ryasmi/066d3e52ff48d65b7f25 to your computer and use it in GitHub Desktop.
Explains how statements and attachments are linked in the xAPI.

The statements are linked to the attachment via the sha2 property inside the statement's attachment property and the X-Experience-API-Hash header inside the attachment part of the request/response. Please see the example request body below.

--abcABC0123'()+_,-./:=?
Content-Type:application/json

{
  "attachments": [{
    "usageType":"http:\/\/id.tincanapi.com\/attachment\/supporting_media",
    "display":{
      "en-US":"myfile.txt"
    },
    "contentType":"plain\/text",
    "length":4,
    "sha2":"AAA"
  }],
  "actor": {
    "mbox":"mailto:[email protected]"
  },
  "verb": {
    "id":"http://www.example.com/verb"
  },
  "object": {
    "id":"http://www.example.com/object"
  }
}
--abcABC0123'()+_,-./:=?
Content-Type:plain/text
Content-Transfer-Encoding:binary
X-Experience-API-Hash:AAA

Some text

Statement link

    "sha2":"AAA"

Attachment link

X-Experience-API-Hash:AAA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment