RESTful Web 服务的 URI - 第 2 部分 [英] URI for RESTful Web Services - Part 2

查看:43
本文介绍了RESTful Web 服务的 URI - 第 2 部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试了解如何为 RESTful Web 服务构建 URI.假设我有一个约会网站,以下是否正确:

I'm trying to understand how to construct URIs for RESTful web services. Assume I had a dating site, would the following be correct:

  • domain.com/profiles/<-- 配置文件列表
  • domain.com/profiles/123/<-- 配置文件编号 123
  • domain.com/profiles/123/likes/<-- 个人资料 123 的喜欢列表
  • domain.com/profiles/123/likes/2/<-- 个人资料 123 的赞列表中的第二项

我是关闭了还是我完全错了?

Am I close or did I get this totally wrong?

推荐答案

想想你的 URL 是否为 GET、POST、PUT 和 DELETE 请求提供了有意义的操作.这才是 REST 的真正意义所在,而不是漂亮的 URL.

Just think about whether your URLs provide meaningful operations for GET, POST, PUT and DELETE requests. That's what REST is really about, rather than beautiful URLs.

这篇关于RESTful Web 服务的 URI - 第 2 部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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