curlを使ってthanksのAPIから投稿してみる

thanksって

THANKSはみんなの「ありがとう」をたくさん集めて、
世界をちょっとだけ幸せにするサービスです。

このコンセプトがすごく好き


まずは投稿
[POST]
Request:
ゲストメッセージの投稿

curl -d "api_key=APIキー" -d "to_name=宛名" -d "guest_name=ゲスト名" -d "body=
メッセージ" -d "public_yn=公開設定" -d "tag=タグ名" http://thanks.kayac.com/api/pub/say/guest_thanks

Response:

{"id":~,"result":"success","status":201}


投稿したメッセージの確認
[GET]
Request:
ゲストメッセージの取得

curl http://thanks.kayac.com/api/pub/read/guest_thanks?api_key=APIキー

Response:
投稿したゲストメッセージがJSON形式で返ってくる

{
  "result":"success",
  "total_results":1,
  "start_index":1,"items_per_page":1,
  "entry":[
    {
      "id":~,
      "to_name":"~",
      "guest_name":"~",
      "body":"test",
      "public_yn":"n",
      "language":"ja",
      "tag":"~"
     }
   ]
}

できたー


参考URL:
thanks - 開発者の皆様へ