Thanks for using Moves As of July 31, 2018, you can no longer log in or use the Moves app. Thank you for your support over the years and for being a Moves user.
Thanks for using Moves As of July 31, 2018, you can no longer log in or use the Moves app. Thank you for your support over the years and for being a Moves user.
Sinatraと小さいAPIはとても相性がいい。 APIで返すものといえばJSONが最近は楽ですね。 まあ普通にrequire "json"して、#to_jsonすればよいのですが、 sinatra-contribにあるsinatra/jsonを使うのもよいかと思います。 Sinatraだけの場合 app.rb require "sinatra" require "json" get '/' do content_type :json data = { foo: "bar" } data.to_json end Sinatra::JSONを使う場合 Gemfile gem "sinatra" gem "sinatra-contrib" app.rb require "sinatra" require "sinatra/json" get '/' do data = { foo: "bar"
2014年に向けた JSON API の実装の方向性と X-JSON-Status 改め X-API-Status header のご提案 追記 2014/11/20 14:00:00 わりと JSON やら XML やら各種フォーマットで API を運用している環境がある場合に JSON API の時だけ X-JSON-Status にすると XML とかの時と整合性取れないし、 X-XML-Status みたいのを量産するのは困る的なレビューを頂いたので X-JSON-Status をやめて X-API-Status にしました。 へたに JSON に限定するから REST とか JSON-RPC とかいわれるんや! X-API-Status にしたら全部解決したし MessagePack な API でも使い回せるって songmu さん言ってた! XML とかからどうやって引っこ抜
WEBアプリの開発で テストの為に JSONのデータをPOSTしたいことがありますが、 curl を使ってコマンドラインからデータをPOSTすることが出来ます。 いつも書き方を忘れるので 備忘録として記録。 curl で JSON データをPOST % curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"user":{"first_name":"firstname","last_name":"lastname","email":"email@email.com","password":"app123","password_confirmation":"app123"}}' http://localhost:3000/api/1/users stackoverflow.
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く