ヘッダを使用した場合、Context Brokerはサポートされていないフォーマットを返そうとしますが、/v2/entities/{entityId}/attrs/{attrName}/value
の動作には疑問があります。Accept:*/* `ヘッダで属性値の動作を取得する
curl -v orion:1026/v2/entities/Bcn-Welt/attrs/humidity/value
* Hostname was NOT found in DNS cache
* Trying 172.17.0.13...
* Connected to orion (172.17.0.13) port 1026 (#0)
> GET /v2/entities/Bcn-Welt/attrs/humidity/value HTTP/1.1
> User-Agent: curl/7.35.0
> Host: orion:1026
> Accept: */*
>
< HTTP/1.1 406 Not Acceptable
< Connection: Keep-Alive
< Content-Length: 73
< Content-Type: application/json
< Fiware-Correlator: d289fd9e-2329-11e6-88cc-0242ac11000d
< Date: Thu, 26 May 2016 10:08:41 GMT
<
* Connection #0 to host orion left intact
{"error":"NotAcceptable","description":"accepted MIME types: text/plain"}
私たちは、明示的にtext/plain
形式同意する必要があります:私たちは受け入れられたフォーマットのリストまたは(JSONを除く)にも対応していないフォーマットを提供した場合、アプリケーションが値を返す
curl -v orion:1026/v2/entities/Bcn-Welt/attrs/humidity/value --header "Accept: text/plain"
* Hostname was NOT found in DNS cache
* Trying 172.17.0.13...
* Connected to orion (172.17.0.13) port 1026 (#0)
> GET /v2/entities/Bcn-Welt/attrs/humidity/value HTTP/1.1
> User-Agent: curl/7.35.0
> Host: orion:1026
> Accept: text/plain
>
< HTTP/1.1 200 OK
< Connection: Keep-Alive
< Content-Length: 9
< Content-Type: text/plain
< Fiware-Correlator: 70b2a3f8-232b-11e6-a36a-0242ac11000d
< Date: Thu, 26 May 2016 10:20:16 GMT
<
* Connection #0 to host orion left intact
を。
curl -v orion:1026/v2/entities/Bcn-Welt/attrs/humidity/value --header "Accept: audio/*"
* Hostname was NOT found in DNS cache
* Trying 172.17.0.13...
* Connected to orion (172.17.0.13) port 1026 (#0)
> GET /v2/entities/Bcn-Welt/attrs/humidity/value HTTP/1.1
> User-Agent: curl/7.35.0
> Host: orion:1026
> Accept: audio/*
>
< HTTP/1.1 200 OK
< Connection: Keep-Alive
< Content-Length: 9
< Content-Type: text/plain
< Fiware-Correlator: a216e33c-232b-11e6-83f3-0242ac11000d
< Date: Thu, 26 May 2016 10:21:39 GMT
<
* Connection #0 to host orion left intact
60.000000
我々は受け入れリストにJSON形式を提供する場合、要求は失敗します。場合によって
curl -v orion:1026/v2/entities/Bcn-Welt/attrs/humidity/value --header "Accept: text/plain" --header "Accept: application/json"
* Hostname was NOT found in DNS cache
* Trying 172.17.0.13...
* Connected to orion (172.17.0.13) port 1026 (#0)
> GET /v2/entities/Bcn-Welt/attrs/humidity/value HTTP/1.1
> User-Agent: curl/7.35.0
> Host: orion:1026
> Accept: text/plain
> Accept: application/json
>
< HTTP/1.1 406 Not Acceptable
< Connection: Keep-Alive
< Content-Length: 73
< Content-Type: application/json
< Fiware-Correlator: 375fb1a8-232c-11e6-a21e-0242ac11000d
< Date: Thu, 26 May 2016 10:25:49 GMT
<
* Connection #0 to host orion left intact
{"error":"NotAcceptable","description":"accepted MIME types: text/plain"}
ケース3について、私はOrionがAcceptのマルチヘッダーをサポートしているとは不確実です(問題はhttps://github.com/telefonicaid/fiware-orion/issues/2209で作成されています)。カンマ区切りのリスト、つまり「Accept:text/plain、application/json」をサポートしています。おそらく、最後のAcceptヘッダー(application/json)だけが考慮されている可能性がありますので、このケースはケース1と完全に等しくなります。 – fgalan
回答テキストが編集され、新しいプロシージャを実装するOrionバージョンに関する情報が含まれますオリオン1.3.0、7月または8月末までにリリース予定)。 – fgalan