REST GET带参数的动词 [英] REST GET verb with parameters

查看:158
本文介绍了REST GET带参数的动词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在和其他队友一起阅读一些REST,我们正在编写一个RoR应用程序,它将向世界其他地方展示它的一些功能。



我在这个团队的任务是制作一份暴露日记报告的资源。如果您致电


http://

您应该从服务中获取所有journalreports。这就像一个魅力,但我很困惑如何妥善制作暴露一系列journalreports的资源。我应该做到吗?


http://root.com/journalreports?range=1/2/2010;5/2/2010


或者当我们讨论REST时,这是非法的,因为?range = interference?

什么是最合适的方式给一个REST的资源一些参数?

解决方案

参数完全可以,特别是对于您的案例(查询一组日记账)的搜索资源。



I 最近回答了类似的问题(路径与参数)

I'm sitting reading on some REST with my fellow teammates, we are writing a RoR application that is going to expose some of its functionality to the rest of the world.

My task on this team is to make a ressource that exposes journal reports. If you call

http://root.com/journalreports

You should get all the journalreports from the service. Thats working like a charm, but I'm confused on how to properly make a ressource that exposes a range of journalreports. Should I make it

http://root.com/journalreports?range=1/2/2010;5/2/2010

Or is this illegal when we talk about REST because of the ?range= interference?

What is the most proper way of giving a REST ressource some parameters?

解决方案

Parameters are perfectly OK, especially for search-resources like in your case (querying a set of journals).

I recently answered similar question (path vs. parameter)

这篇关于REST GET带参数的动词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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