restful-url

When do I use path params vs. query params in a RESTful API?

大憨熊 提交于 2019-11-26 18:45:36
问题 I want to make my RESTful API very predictable. What is the best practice for deciding when to make a segmentation of data using the URI rather than by using query params. It makes sense to me that system parameters that support pagination, sorting, and grouping be after the '?' But what about fields like 'status' and 'region' or other attributes that segment your collection? If those are to be query params as well, what is the rule of thumb on knowing when to use path params? 回答1: Best

How to create REST URLs without verbs?

我们两清 提交于 2019-11-26 15:34:05
I'm struggling to determine how to design restful URLs. I'm all for the restful approach of using URLs with nouns and not verbs don't understand how to do this. We are creating a service to implement a financial calculator. The calculator takes a bunch of parameters that we will upload via a CSV file. The use cases would involve: Upload new parameters Get the latest parameters Get parameters for a given business date Make a set of parameters active Validate a set of parameters I gather the restful approach would be to have the following type URLs: /parameters /parameters/12-23-2009 You could

Spring MVC Controller: Redirect without parameters being added to my url

霸气de小男生 提交于 2019-11-26 12:42:37
问题 I\'m trying to redirect without parameters being added to my URL. @Controller ... public class SomeController { ... @RequestMapping(\"save/\") public String doSave(...) { ... return \"redirect:/success/\"; } @RequestMapping(\"success/\") public String doSuccess(...) { ... return \"success\"; } After a redirect my url looks always something like this: .../success/?param1=xxx&param2=xxx . Since I want my URLs to be kind of RESTful and I never need the params after a redirect, I don\'t want them

What’s the best RESTful method to return total number of items in an object?

早过忘川 提交于 2019-11-26 12:34:47
问题 I’m developing a REST API service for a large social networking website I’m involved in. So far, it’s working great. I can issue GET , POST , PUT and DELETE requests to object URLs and affect my data. However, this data is paged (limited to 30 results at a time). However, what would be the best RESTful way to get the total number of say, members, via my API? Currently, I issue requests to a URL structure like the following: /api/members —Returns a list of members (30 at a time as mentioned

Jersey with Struts2 [duplicate]

ぐ巨炮叔叔 提交于 2019-11-26 06:49:43
问题 This question already has an answer here: Request is going to Struts Dispatcher 2 answers I am using jersey with Struts2. But by RestFul Service calls are not working. Below are my configurations files struts.xml <?xml version=\"1.0\" encoding=\"UTF-8\"?> <!DOCTYPE struts PUBLIC \"-//Apache Software Foundation//DTD Struts Configuration 2.1//EN\" \"http://struts.apache.org/dtds/struts-2.1.dtd\"> <struts> <package name=\"default\" namespace=\"/\" extends=\"struts-default\"> <result-types>