Undestanding the difference between a JSON-LD definition and what the API actually returns

28 Views Asked by At

I am trying to implement LTI Names and Role Provisioning Services (LTI-NRPS), which allows a tool (my application) to get a list of participants from a learning management system (LMS).

According to the documentation, accessing the "context membership" API returns a simple JSON document. This also matches what I get when accessing the API myself:

{
"id" : "https://lms.example.com/sections/2923/memberships",
"context": {
  "id": "2923-abc",
  "label": "CPS 435",
  "title": "CPS 435 Learning Analytics",
},
"members" : [
  {
    "status" : "Active",
    "name": "Jane Q. Public",
    "picture" : "https://platform.example.edu/jane.jpg",
    "given_name" : "Jane",
    "family_name" : "Doe",
    "middle_name" : "Marie",
    "email": "[email protected]",
    "user_id" : "0ae836b9-7fc9-4060-006f-27b2066ac545",
    "lis_person_sourcedid": "59254-6782-12ab",
    "roles": [
      "http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor"
    ]
  }
]
}

However, the caption says "Figure 1 Example of application/vnd.ims.lti-nrps.v2.membershipcontainer+json media type." When I search for this media type (it is mentioned that it is defined in the "accompanying HTML documentation", but not actually quoted or linked), I find this definition of the LISMembershipContainer JSON Binding, which looks different:

{
  "@context" : [
    "http://purl.imsglobal.org/ctx/lis/v2/MembershipContainer",
    {
      "liss" : "http://purl.imsglobal.org/vocab/lis/v2/status#",
      "lism" : "http://purl.imsglobal.org/vocab/lis/v2/membership#"
    }
  ],
  "@type" : "Page",
  "@id" : "http://lms.example.com/sections/2923/memberships/?rlid=49566-rkk96",
  "nextPage" : "http://lms.example.com/sections/2923/memberships/?rlid=49566-rkk96&p=2",
  "differences" : "http://lms.example.com/sections/2923/memberships/?x=1422554502",
  "pageOf" : {
    "@type" : "LISMembershipContainer",
    "membershipSubject" : {
      "@type" : "Context",
      "contextId" : "2923-abc",
      "membership" : [
        {
          "status" : "liss:Active",
          "member" : {
            "@type" : "LISPerson",
            "sourcedId" : "school.edu:user",
            "userId" : "0ae836b9-7fc9-4060-006f-27b2066ac545",
            "email" : "[email protected]",
            "familyName" : "Public",
            "name" : "Jane Q. Public",
            "image" : "http://...",
            "givenName" : "Jane"
          },
          "message" : [
            {
              "message_type" : "basic-lti-launch-request",
              "lis_result_sourcedid" : "83873872987329873264783687634",
              "ext" : {
                "user_username" : "jpublic"
              },
              "custom" : {
                "country" : "Canada",
                "user_mobile" : "123-456-7890"
              }
            }
          ],
          "role" : [
            "lism:Instructor"
          ]
        }
      ]
    }
  }
}

First of all, there is pagination. Ignoring that, the container has an interstitial membershipSubject field in which there is an object of @type Context - instead of having a field called Context. We also have membershipSubject instead of members. I feel the first JSON document is an alternate form of the same schema, but where is it defined? Is there a standard transformation from JSON-LD to "simple JSON"? I wonder where the pluralized forms like members come from, for example.

0

There are 0 best solutions below