Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

入出金 API には冪等性があるため PUT メソッドにできます #24

Open
negokaz opened this issue Sep 23, 2021 · 0 comments

Comments

@negokaz
Copy link
Contributor

negokaz commented Sep 23, 2021

入出金 API は transactionId により冪等性が保証されています。

入出金 API の概要: lerna-stack/lerna-sample-account-app

現在は POST メソッドの API として定義されていますが、PUT メソッドの API にすることもできます。

PUT と POST との違いは、PUT はべき等であり、呼び出し回数が1回でも複数回でも同じ効果になります(副作用がありません)が、連続して同じ POST を実行すると、注文を複数回渡してしまうなどの追加の影響が発生する可能性があります。

PUT - HTTP | MDN

PUT メソッドの API として定義したほうが、冪等性を持つことが伝わりやすくなることが期待できます。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant