タグ

jsonとapiに関するkatttonのブックマーク (3)

  • RailsでAPIをつくるときのエラー処理 - Qiita

    例外を利用して実装すると便利な場合が多い この投稿では、HTTP経由でJSONを返すようなWeb APIRailsを利用して実装するとき、エラーレスポンスを返す場合の処理をどう実装するとやりやすいのか、というニッチな話題に触れる。APIでエラーを返したいとき、即ち400以上のステータスコードと共にレスポンスを返したいような場合、どう実装するのが良いか。もしリクエストの処理中にエラーが検出された場合、それ以降の処理を行わずに直ちに中断してエラーレスポンスを返したいという場合が多いため、例外を利用して実装すると便利な場合が多い。 例外を利用しない方が良い場合もある 1つのリクエストに複数の問題が含まれている場合、先に見つけた問題だけを報告するようなエラーレスポンスを返すのか、それとも問題を抱えながらも進めるところまで処理を進めて報告可能な情報を全て含むようなエラーレスポンスを返すのか、という

    RailsでAPIをつくるときのエラー処理 - Qiita
  • JSON API — A specification for building APIs in JSON

    If you’ve ever argued with your team about the way your JSON responses should be formatted, JSON:API can help you stop the bikeshedding and focus on what matters: your application. By following shared conventions, you can increase productivity, take advantage of generalized tooling and best practices. Clients built around JSON:API are able to take advantage of its features around efficiently cachi

  • Kirill Platonov

    Hey! I am Kirill Platonov, a software developer, and indie hacker. I specialize in building and scaling Shopify Apps with Ruby on Rails, Hotwire and Polaris ViewComponents. I am currently building my portfolio of 5 Shopify Apps and maintaining a handful of open source projects. Bulk Price Editor Simple and reliable price editor for Shopify. Allows managing prices and scheduling sales from one app.

    Kirill Platonov
    kattton
    kattton 2014/11/11
    あとjbuilderはpartialを使うと更に遅くなる。AMSはpageとかtotal_countなどのメタ情報を入れようと思うとツラくなる。結局jbuilderを使っているけど速度問題が深刻になったらAMS使うかもしれんね。
  • 1