JSON Hydra控制台无法正常检测

时间:2016-03-29 23:15:39

标签: json-ld hydra-core

我最近刚开始尝试使用Hydra控制台。看着我,因为它被打破了。

如果您导航到公开版本:http://www.markus-lanthaler.com/hydra/console/#

并输入以下网址:http://kadebom.com/EntryPoint.jsonld(这是the example的完整副本,但我的服务器除外)

它只返回"@context":并且没有任何值存在。

请参阅屏幕截图:

  

Screenshof Hydra Console output, showing only '{ "@context": }'

JS控制台中没有错误。我尝试将我的Apache配置更改为Access-Control-Allow-Origin: *,但无济于事。

有人可以告诉我我做错了吗?

2 个答案:

答案 0 :(得分:1)

您的文件似乎不是一个精确的副本(我在阅读您自己的答案后再假设)。在其中放置the example的精确副本,并确保使用正确的内容类型提供,即Content-Type: application/ld+json

如果您希望右侧的文档也显示出来,您还需要从Link标题中引用ApiDocumentation,如示例所示(执行curl -i http://www.markus-lanthaler.com/hydra/api-demo/contexts/EntryPoint.jsonld以查看演示了。

顺便说一下。我建议你改为Event API Demo

答案 1 :(得分:0)

出于某种原因,在任何文档中都未指定,如果有,请提供,我的json文档必须是:

{
"@context": {
    "__value": "/hydra/api-demo/contexts/EntryPoint.jsonld",
    "__activectx": {
        "@base": {},
        "hydra": {
            "@id": "http://www.w3.org/ns/hydra/core#",
            "@reverse": false
        },
        "vocab": {
            "@id": "http://www.markus-lanthaler.com/hydra/api-demo/vocab#",
            "@reverse": false
        },
        "EntryPoint": {
            "@id": "http://www.markus-lanthaler.com/hydra/api-demo/vocab#EntryPoint",
            "@reverse": false
        },
        "issues": {
            "@id": "http://www.markus-lanthaler.com/hydra/api-demo/vocab#EntryPoint/issues",
            "@reverse": false,
            "@type": "@id"
        },
        "register_user": {
            "@id": "http://www.markus-lanthaler.com/hydra/api-demo/vocab#EntryPoint/registerUser",
            "@reverse": false,
            "@type": "@id"
        },
        "my_account": {
            "@id": "http://www.markus-lanthaler.com/hydra/api-demo/vocab#EntryPoint/myAccount",
            "@reverse": false,
            "@type": "@id"
        },
        "users": {
            "@id": "http://www.markus-lanthaler.com/hydra/api-demo/vocab#EntryPoint/users",
            "@reverse": false,
            "@type": "@id"
        }
    }
},
"@id": {
    "__iri": "@id",
    "__value": {
        "__orig_value": "/hydra/api-demo/",
        "__value": {
            "@id": "http://www.markus-lanthaler.com/hydra/api-demo/"
        }
    }
},
"@type": {
    "__iri": "@type",
    "__value": {
        "__orig_value": "EntryPoint",
        "__value": {
            "@id": "http://www.markus-lanthaler.com/hydra/api-demo/vocab#EntryPoint"
        }
    }
},
"issues": {
    "__iri": "http://www.markus-lanthaler.com/hydra/api-demo/vocab#EntryPoint/issues",
    "__value": {
        "__orig_value": "/hydra/api-demo/issues/",
        "__value": {
            "@id": "http://www.markus-lanthaler.com/hydra/api-demo/issues/"
        }
    }
},
"register_user": {
    "__iri": "http://www.markus-lanthaler.com/hydra/api-demo/vocab#EntryPoint/registerUser",
    "__value": {
        "__orig_value": "/hydra/api-demo/users/",
        "__value": {
            "@id": "http://www.markus-lanthaler.com/hydra/api-demo/users/"
        }
    }
},
"users": {
    "__iri": "http://www.markus-lanthaler.com/hydra/api-demo/vocab#EntryPoint/users",
    "__value": {
        "__orig_value": "/hydra/api-demo/users/",
        "__value": {
            "@id": "http://www.markus-lanthaler.com/hydra/api-demo/users/"
        }
    }
}

}

而不是如果你去这个网址将会下载的内容:

http://www.markus-lanthaler.com/hydra/event-api/