列出所有实体资源功能似乎在API v2中失败

时间:2016-04-07 12:32:53

标签: fiware-orion

如果我们按http://fiware.github.io/context.Orion/api/v2/cookbook/中所述执行<cb_url>:<cb_port>/v2/entitites/EntityId/attrs请求,我们会收到&#34;未找到的服务&#34;错误。

对于此测试,我们使用了https://hub.docker.com/r/fiware/orion/

中的Docker镜像

有关构建的版本信息:

{
  "orion" : {
  "version" : "1.0.0-next",
  "uptime" : "1 d, 3 h, 48 m, 6 s",
  "git_hash" : "b6752828f37711bed6e1ff670207d6b984bc9570",
  "compile_time" : "Tue Apr 5 18:25:46 UTC 2016",
  "compiled_by" : "root",
  "compiled_in" : "838a42ae8431"
  }
}

复制步骤:

创建一个实体:

(curl -X POST <orion_host>:1026/v2/Entities?options=keyValues -s -S --header 'Content-Type: application/json' \
    --header 'Accept: application/json' -d @- | python -mjson.tool) <<EOF
{
    "type": "Review",
    "id": "review-36",
    "author": "AuthorId",
    "itemReviewed": "LeBistro",
    "reviewBody": "Body of the review",
    "ratingValue": 4
}
EOF

尝试使用以下方法检索其属性:

curl <orion_host>:1026/v2/Entities/review-36/attrs

curl <orion_host>:1026/v2/Entities/review-36/attrs?options=keyValues

在这两种情况下,我们得到:

{
    "error": "BadRequest",
    "description": "service not found"
}

如果我们执行:

curl <orion_host>:1026/v2/Entities/review-36

我们得到:

{
    "id": "review-36",
    "type": "Review",
    "author":
    {
        "type": "none",
        "value": "AuthorId",
        "metadata": {}
    },
    "itemReviewed":
    {
        "type": "none",
        "value": "LeBistro",
        "metadata": {}
    },
    "ratingValue":
    {
        "type": "none",
        "value": 4,
        "metadata": {}
    },
    "reviewBody":
    {
        "type": "none",
        "value": "Body of the review",
        "metadata": {}
    }
}

或者如果我们执行:

curl <orion_host>:1026/v2/Entities/review-36?options=keyValues

我们得到:

{
    "id": "review-36",
    "type": "Review",
    "author": "AuthorId",
    "itemReviewed": "LeBistro",
    "ratingValue": 4,
    "reviewBody": "Body of the review"
}

2 个答案:

答案 0 :(得分:1)

我建议使用reference代替cookbook

在这种情况下,您的问题是网址/v2/Entities/review-36/attrs格式不正确。

可能的请求:

  • GET /v2/entities - &gt;返回所有实体
  • GET /v2/entities/<id> - &gt;返回与此ID相关联的实体
  • GET /v2/entities/<id>/attrs/<attr_name> - &gt;仅返回与此id
  • 关联的实体中的属性
  • GET /v2/entities/<id>/attrs/<attr_name>/value - &gt;仅将与属性关联的属性值返回到具有此id
  • 的实体

答案 1 :(得分:0)

我认为/ attrs不是“格式错误的网址”,这是尚未实现的内容......