Restlet API のセットを最適にレイアウトする方法を見つけようとしています。私は User エンティティを持っています。これは標準の CRUD 操作を持っている可能性があり、残りにうまく適合しますが、「パスワードのリセット」や「終了」のようなものもあります。
これをレイアウトする最良の方法は何ですか?
これが私が考えていたことです:
/1.0/user/update //perhaps this would just be a PUT on /1.0/user
/1.0/user/resetPassword //This would reset the password, but also send an email.
/1.0/user/terminate //This might do some additional cleanup
次に、このように実際にアタッチする UserResource を作成します
/1.0/user/{actionType}
処理コードは次のようになります (擬似):
action = request.getAttributes().get("actionType");
if (action == "update") {
do update
} elif (action == "resetpassword") {
do resetpassword
} elif (action == "terminate") {
do terminate
}
本当に悪い考えですか?本当に忍者のアイデア?