「デバイス側Path設定」 を利用しない¶
本チュートリアルでは、 IoT Connect Gateway の 「デバイス側Path設定」 を利用しない場合の設定・操作方法をご説明いたします。
「デバイス側Path設定」 機能の設定方法 (IoT Connect Gateway 側)¶
ストレージ新規作成ページ内で デバイス側Path設定 をOFFにします。
- 宛先設定
ファイルパス
クラウドストレージ側で設定したファイルパスを指定してください。
その他の項目の設定内容については、 こちら を参照ください。
また、プレースホルダの機能が利用できます。詳細については、 こちら を参照ください。
「デバイス側Path設定」 機能の操作方法 (デバイス側)¶
デバイス毎に操作方法は異なります。下記はあくまで一例として参考にしてください。
ファイルのアップロード
コマンド構成
curl \ -X PUT \ -H "icgw-storage-bucket: <バケット名>" \ #icgw-storage-bucket に任意のバケット名を指定可能 --data-binary \ "<ファイル名>" "http://<エントリーポイント>/<PATH>"
コマンド例
- IoT Connect Gateway に以下の設定を行い、下記のコマンドを実行しています。
バケット:sc-test
ファイルパス:test2.txt
curl -X PUT --data-binary "@test2.txt" "http://an1.icgw.ntt.com:8081/test"
レスポンス例
{ "statusCode":200, "body":{ "result":"ok", "detail": { "ETag":"\"da4b3de6fafcfc74412c6fa0ee55cc79\"", "Location":"https://sc-test.s3.ap-northeast-1-ntt.wasabisys.com/test/test2.txt", "key":"test/test2.txt", "Key":"test/test2.txt", "Bucket":"sc-test" } }
ファイルのダウンロード
コマンド構成
curl \ -X GET \ "http://<エントリーポイント>/<PATH>/<ファイル名>"
コマンド例
curl -X GET "http://an1.icgw.ntt.com:8081/test/test2.txt"
ファイル一覧の取得
コマンド構成
curl \ -X GET \ -H "icgw-storage-bucket: <バケット名>" \ #icgw-storage-bucket に任意のバケットを指定可能 -H "icgw-storage-method: listObject" \ #一覧取得時に必須のヘッダーオプション "http://<エントリーポイント>/<PATH>"
コマンド例
curl -X GET -H "icgw-storage-method: listObject" "an1.icgw.ntt.com:8081/"
レスポンス例
{ "statusCode":200, "body":{ "result":"ok", "detail": { "IsTruncated":false, "Marker":"", "Contents": { "Key":"test/test2.txt", "LastModified":"2022-08-10T06:40:02.000Z", "ETag":"\"d32944c6eafbf733b9e0688b980eb383\"", "ChecksumAlgorithm":[], "Size":16,"StorageClass":"STANDARD", }, "Name":"sc-test", "Prefix":"", "MaxKeys":1000, "CommonPrefixes":[] } } }