基于REST的API:如何模拟“重设密码”? [英] RESTful API: How to model 'request new password'?

查看:391
本文介绍了基于REST的API:如何模拟“重设密码”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设计一个RESTful API的应用程序预订,是很高兴看到我可以在应用程序的所有细节映射到4 HTTP方法。

  /用户 -  GET,POST
/用户/({ID} |我自己) - GET,POST,PUT,DELETE
/用户/({ID} |我自己)/预订 - GET,POST
/用户/({ID} |我自己)/预订/ {ID} - GET,POST,PUT,DELETE

例如:更新我自己的用户使用PUT到/用户/我自己

但现在我发现了一件事情,就是丢失:请求一个新密码,如果我忘记了旧标准的可能性。任何想法我怎么能添加此?


解决方案

  /用户/({ID} |我自己)/ forgottenpassword /,GET或PUT

或只是实施,告诉用户去该网站的某种方式。

I am designing a RESTful API for a booking application and was quite happy to see I could map all details of the application to the 4 HTTP methods.

/users - GET, POST
/users/({id}|myself) - GET, POST, PUT, DELETE
/users/({id}|myself)/bookings - GET, POST
/users/({id}|myself)/bookings/{id} - GET, POST, PUT, DELETE

Example: Updating my own user uses a PUT to /users/myself.

But now I found out that one thing is missing: The possibility to request a new password if I forgot my old one. Any idea how I could add this?

解决方案

/users/({id}|myself)/forgottenpassword/, GET or PUT

or just implement some way of telling the user to go to the website.

这篇关于基于REST的API:如何模拟“重设密码”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆