2021/9/21 インターンシップ
インターンシップメモ
- プレゼン用に出来事をまとめていく。
- エラーがfiware特有で記事が少ない。
- fiwareのorionにnode.jsからデータをpostするコードメモ。entitiesで[]で囲むことを忘れずに。
var request = require('request'); var fs = require("fs"); var options = { // method: "POST", uri: "http://localhost:1026/v2/op/update", headers: { "Content-type": "application/json", }, json: { "actionType":"append", "entities": [ { "id": "urn:ngsi-ld:Product:010", "type": "Product", "name": { "type": "Text", "value": "Lemonade", "metadata": {} }, "price": { "type": "Integer", "value": 99, "metadata": {} }, "size": { "type": "Text", "value": "S", "metadata": {} } }, { "id": "urn:ngsi-ld:Product:012", "type": "Product", "name": { "type": "Text", "value": "Port", "metadata": {} }, "price": { "type": "Integer", "value": 1099, "metadata": {} }, "size": { "type": "Text", "value": "M", "metadata": {} } } ] } }; request.post(options, function(error, response, body){ if (error) throw new Error(error); console.log(body); });
- データの取り込みまではOK。(JSONファイルからできればやる)
- サーバーをカスタマイズできるところはする。
データの表示でエラーが出ている。
NECさくらの実証環境ではちゃんとできたので設定を見直したらできる?
- 個人的にできたらしたい
- コマンドを作って操作できたら
- npmライブラリ使って実装。メンテされてないから使った方がいいかわからない。
- アプリケーションから操作や表示ができたらわかりやすい。コマンドラインで見にくい。(そのようなアプリあるか確認)