Question about IriTemplateMapping

Hi all,

I've got a question about Hydra's IriTemplateMappings that I was hoping the group could answer. Is this the best place to ask questions? I'm happy to raise it elsewhere if required.

I'm modelling users, called agents in the API. Each agent can have several profiles assigned to them, for example:


{

    "@type" : "Agent",

    ...

    "username" : "scottm",

    "hasProfiles" : [

        {

            "@type" : "Profile",

            "identifier" : "EmailAgentProfile"

        },

        {

            "@type" : "Profile",

            "identifier" : "TelephonyAgentProfile"

        }

    ],

}

Each user has a set of permissions which are computed based on their profile. If I want to load an agent's permissions I need to include the identifier of one of their profiles.

We've represented this using an IriTemplate on the agent resource. The part I'm struggling with is how to tell the client that they need to pick one of the profiles from the hasProfiles list. At the moment I've got:


{

    ...the same content as the first example, followed by

    "findPermissions" : {

        "@type" : "hydra:IriTemplate",

        "hydra:template" : "http://localhost:8280/agent-service/default/agents/scottm/permissions{?profile}",

        "hydra:mapping" : [ {

            "@type"          : "IriTemplateMapping",

            "hydra:variable" : "profile",

            "hydra:property" : "hasProfiles",

            "hydra:required" : true

        }

    }

}

But hasProfiles is a list of profiles, not the identifier for a specific one. The API is expecting an IRI that looks something like http://localhost:8280/agent-service/default/agents/scottm/permissions?profile=EmailAgentProfile.

The only other option I can see is to set hydra:property in the mapping to "identifier", since that is the property on the profile that we want to actually use in the IRI. The downside to that is it doesn't tell the client where to get that identifier from the resource they have to hand.

Any suggestions?

Thanks,
Scott



This electronic message may contain proprietary and confidential information of Verint Systems Inc., its affiliates and/or subsidiaries. The information is intended to be for the use of the individual(s) or entity(ies) named above. If you are not the intended recipient (or authorized to receive this e-mail for the intended recipient), you may not use, copy, disclose or distribute to anyone this message or any information contained in this message. If you have received this electronic message in error, please notify us by replying to this e-mail.

Received on Monday, 30 March 2020 13:22:46 UTC