第2のポイント-Metadata Resolver
前回は技術的な概要のうち,
Metadata Resolverは,
しかし,
サーバサイドのコードは,
連載第1回の概要説明で簡単には説明しましたが,
- 注1)
- ただし,
上で説明した通り, 規格としてしっかりしたものではないため, あくまで現状での説明になり, 今後変更が行われて行く可能性は非常に高いと思われます。
Metadata ResolverのInterface
対応アプリケーションがUriBeaconから放出されたアドバタイジングパケットをスキャンすると,
Request
問い合わせたいURLについて,
{"objects": [{"url": "http://goo.gl/f7BSAj"}]}
次のように複数のURLについてまとめて問い合わせることも出来るようになっています。
{"objects": [
{"url": "http://goo.gl/f7BSAj"},
{"url": "http://goo.gl/EKqGSz"}
]}
Response
次のようなJSONがレスポンスデータとして返ることになっています。
{"metadata":[
{
"id":"http://goo.gl/f7BSAj",
"title":"The Physical Web",
"url":"http://google.github.io/physical-web/",
"icon":"http://google.github.io/physical-web/images/logo-black.png",
"description":"Walk up and use anything",
"json-ld":[]
}
]}
次のようなパラメータを持つオブジェクトが渡されているのがわかると思います。 これがMetadataになります。
- id
- title
- url
- icon
- description
- json-ld
複数のURLについて同時に問い合わせたのであれば,
{"metadata":[
{
"id":"http://goo.gl/f7BSAj",
"title":"The Physical Web",
"url":"http://google.github.io/physical-web/",
"icon":"http://google.github.io/physical-web/images/logo-black.png",
"description":"Walk up and use anything",
"json-ld":[]
},
{
"id":"http://goo.gl/EKqGSz",
"title":"google/uribeacon · GitHub",
"url":"https://github.com/google/uribeacon",
"icon":"https://avatars2.githubusercontent.com/u/1342004?v=3\u0026s=400",
"description":"uribeacon - The Web Uri Open Beacon for the Internet of Things",
"json-ld":[]
}
]}