- From: Markus Lanthaler <markus.lanthaler@gmx.net>
- Date: Wed, 2 Oct 2013 21:14:44 +0200
- To: <public-hydra@w3.org>
On Wednesday, October 02, 2013 4:29 PM, Ryan J. McDonough wrote:
> I'm in the process of trying to describe a service using Hydra and was
Cool! Can you share a bit more about this service?
> having some trouble trying to express an IriTemplate for a given
> operation. I'm trying to describe a GET request with the following URI
> template and it's mapping:
>
> http://uri-templates.herokuapp.com/uri-template{?template}
>
> My initial version used JSON Hyper schema like this:
>
> {
> "href": "/uri-template",
> "rel": "about",
> "method": "GET",
> "enctype": "application/www-form-urlencoded",
> "mediaType":
> "application/json;profile='/schema/uriTemplateStructure'",
> "schema": {
> "type": "object",
> "properties": {
> "template": { "type": "string" }
> },
> "required": [ "template" ]
> }
> }
>
> What I've got so far is this with Hydra is this:
>
> {
> "@type": "hydra:IriTemplate",
> "template": {
> "template": "http://uri-templates.herokuapp.com/uri-
> template{?template}",
> "mappings": [
> {
> "@type": "IriTemplateMapping",
> "variable": "template",
> "property": "app:template",
> "required": true
> }
> ]
> }
> }
>
> I don't feel I've got it right. Any pointers?
I assume you have already seen the relevant section in the Hydra spec [1],
right? We should definitely add a more complete example to that section.
Your example is more or less correct, you just used template twice which
isn't necessary. Here's how I would model it (using the "about" link
relation from your JSON Hyper-Schema):
{
"about": {
"@type": "hydra:IriTemplate",
"template":
"http://uri-templates.herokuapp.com/uri-template{?template}",
"mappings": [
{
"@type": "IriTemplateMapping",
"variable": "template",
"property": "app:template",
"required": true
}
]
}
}
[1] http://www.markus-lanthaler.com/hydra/spec/latest/core/#templated-links
HTH,
Markus
--
Markus Lanthaler
@markuslanthaler
Received on Wednesday, 2 October 2013 19:15:18 UTC