0

I am trying to retrieve statements based off the context.team (which is an Actor of objectType "Group"). I know that although the query says "agent=..." groups can fit in, c.f. http://docs.learninglocker.net/http-xapi-statements/#get-statements:

agent | JSON encoded object containing an IFI to match an agent or group.

I have tried to query:

{{LrsAddress}}:{{LrsPort}}/data/xAPI/statements?agent={"account": { "name": "Team bogus",  "homePage": "http://xinfo.example.com/xapi/v1/teams/world_class_team"}}&related_agents=true

I can easily retrieve users because the agent query is {"mbox": "mailto:test@mail.com"} which works, however querying an account should be possible since it is a Inverse Functional Identifier as much as "mbox" cf https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Data.md#inversefunctional

The statements I am trying to retrieve are like the following one:

{
"id": "12345678-1234-5678-1234-567812345678",
"actor":{
    "objectType": "Agent",
    "mbox":"mailto:test@mail.com",
    "name": "Agent A"
},
"verb":{
    "id":"http://adlnet.gov/expapi/verbs/created",
    "display":{
        "en-US":"created"
    }
},
"object":{
    "id":"http://example.adlnet.gov/xapi/example/activity"
},
"context": {
           "team": {
                   "objectType": "Group"
                   "name": "Team B",
                   "account": {
                              "name": "Team bogus",
                              "homePage": "http://xinfo.example.com/xapi/v1/teams/world_class_team"
                   },
           "instructor" : {
                            "name": "Trainer C",
                            "mbox": "mailto:trainerC@mail.com",
                            "objectType": "Agent"
    }                   
            }
}

}

I am using an installation of Learning Locker (v1 I think) as my LRS. I am using Postman for my tests which url encodes for me (I have tried queries by manually encoding them as well and I obtained the same results) (interesting fact, maybe relevant to the question, is that pushing in the LRS %20 for spaces instead of using "_" in the team.account.homepage IRI "http://www.example.com/team%20Bogus" is that they are interpreted once queried in the JSON, I assume they should be avoided in IRI)

olliaroa
  • 71
  • 7
  • What is the response from the LRS? Does it have a 400 or 200 status code? Are you URL encoding the JSON of the agent value? The query you are showing isn't a valid URL, please paste the actual URL being used. The spaces in the `homePage` value should work assuming you URL encode the whole thing. – Brian J. Miller Nov 28 '17 at 13:50
  • The response I get is: `{ "more": "", "statements": [] }` and when I couple it with other agent queries it returns something, indicating that's basically not taking it into account: e.g. querying for AgentA+TeamB where ensemble A+B is empty (Agent A only has a statement without that team attribute B ) returns the statement with A. – olliaroa Nov 28 '17 at 15:23
  • also: Postman takes care of the URL encoding (encoding it (%7B%22account%22%3A%20%7B%20%22name%22%3A%20%22Team%20bogus%22%2C%20%20%22homePage%22%3A%20%22http%3A%2F%2Fxinfo.example.com%2Fxapi%2Fv1%2Fteams%2Fworld_class_team%22%7D%7D) gives the same results. The response code is always 200 – olliaroa Nov 28 '17 at 15:56
  • I didn't quite follow, is the agent you are querying on the `actor` of the statement or is it `context.team`? – Brian J. Miller Nov 28 '17 at 20:18
  • apologies: I have added an example to clarify the question. context.team, but it shouldn't matter right? I have tried and I can query for the Instructor (so it's an agent in the context) and it works. – olliaroa Nov 29 '17 at 05:27
  • ok so the error was not in the query json, but in the "related_agents" parameter: https://stackoverflow.com/questions/25389415/is-it-possible-to-filter-statements-by-team-in-tin-can?rq=1 Thanks @BrianJ.Miller for this reply a couple of years ago :) – olliaroa Nov 29 '17 at 06:11

0 Answers0