1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

curl: SORACOM Harvest Files に画像データを送る

Last updated at Posted at 2021-08-01

トークンの取得

get_token.sh
#
EMAIL=guest@example.com
PASSWORD=secret007
#
curl  -X POST -H "Content-Type: application/json" \
        -d "{ \"email\": \"${EMAIL}\", \"password\": \"${PASSWORD}\" }" \
        https://api.soracom.io/v1/auth > token.json
#

画像のアップロード

send_jpg.sh
#
API_KEY=`jq .apiKey token.json | sed 's/"//g'`
API_TOKEN=`jq .token token.json | sed 's/"//g'`
#
FILE="sample01.jpg"
#
echo ${API_KEY}
#
curl -X PUT -H "Content-Type: text/x-sh" -H "X-Soracom-API-Key: ${API_KEY}" \
 -H "X-Soracom-Token: ${API_TOKEN}" --data-binary @${FILE} \
	"https://api.soracom.io/v1/files/private/sample/${FILE}"
#

Harvest Files でデータの確認
harvest_files_aug01.png

参考情報

API キーと API トークン
ファイルを Harvest Files に送信する

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?