piwigo web api と curl
写真を探す
ブラウザでアクセスする場合
http://localhost/piwigo/ws.php?format=rest&method=pwg.images.search&query=file=%2220121124090429_P1010220.JPG%22
curlでアクセスする場合
$ curl "http://localhost/piwigo/ws.php?format=rest&method=pwg.images.search&query=file=%2220121124090429_P1010220.JPG%22"
$ curl "http://localhost/piwigo/ws.php?format=rest&method=pwg.images.search&query=file="20121124090429_P1010220.JPG""
状態を表示する
curl http://localhost/piwigo/ws.php?format=json&method=pwg.session.getStatus
認証
クッキーに保存しないと別のセッションで使えないcurl -c cookie.txt -d 'username=test&password=testtest' "http://192.168.2.2/piwigo/ws.php?format=json&method=pwg.session.login"
成功すれば
{"stat":"ok","result":true}が帰ってくる.
セッションの確認
curl -b cookie.txt "http://192.168.2.2/piwigo/ws.php?format=json&method=pwg.session.getStatus"成功すれば
{"username":"test","status":"normal","theme":"Sylvia","language":"ja_JP","pwg_token":"ea089af0c2aab35bb3158c4b8df7fd72","charset":"utf-8","current_datetime":"2016-09-13 09:01:39","version":"2.7.4"}}lのように帰ってくる.
コメント
コメントを投稿