restful-url

What's a RESTful way to query with logic operation?

我们两清 提交于 2019-12-12 09:44:47
问题 This is a spin-off question to query with filters Say my application is managing objects called workload, with the following fields. I want to expose a REST interface for user to query workloads by labels. "Workload": {"id":"test1", "labels":["A", "B", "C"]} "Workload": {"id":"test2", "labels":["A", "C", "D"]} "Workload": {"id":"test3", "labels":["A", "B", "D"]} Question : How do I design the REST endpoint so that it would support query workload with basic logic operations? Sample Query 2 : I

how to specify a range of data or multiple entities in a restful web-service

那年仲夏 提交于 2019-12-12 09:43:06
问题 To access an instance of a User in a restful web-service the url is structured as shown in the curl request below: curl -v -X GET -s "$BASE_URL/User/${customer_id}.json" If I wanted to specify all User entities or page through a range of User entities, such as the first 50 Users in my database, how would I structure my request so that it is compliant with REST ??? 回答1: You should start by trying to de-emphasize the meaning of the characters in a URI. While nice, pretty and readable URIs are a

unexpected 's' in response of restful service

五迷三道 提交于 2019-12-12 04:58:11
问题 i am trying to learn restful services and as part of that i am designing a sample request and response page...see i am getting everything right except the following resource called: <i> package com.tutorialspoint; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax

Rails CRUD - Destroy path always routes to the User show page

大城市里の小女人 提交于 2019-12-12 02:45:16
问题 My view is the users show page <%= link_to 'Cancel?', {:url => schedule_path, :id => current_user.schedules[0].id, :confirm => "are you sure?", :method => :delete} %> Associations has_many :schedules belongs_to :user routes.rb resources :schedules resources :users I don't match anything in routes.rb. The parameters in the stack trace show id => 93 , which is what I want as I'm trying to destroy the schedule with id 93. But it's routing to the show action of the user's controller when I want

How to add relationships in JAX-RS via RESTful web service?

删除回忆录丶 提交于 2019-12-11 23:52:43
问题 OK I can GET POST PUT DELETE simple resources (entities) in my RESTful web service ex. /rest/foos /rest/foos/1 /rest/bars /rest/bars/1 But how to handle adding relationships ex. @OneToMany, @ManyToMany between this relationships using RESTful web service. Suppose I have several Foo entities and several Bar entities how to establish relationships Bar 1 has Foo 3 , etc. I have such approach to GET this relationships: GET /rest/bars/1/foos Above returns collection of foos related with Bar(id=1)

JSON object imparting partial NULL values when passed to POJO thorugh AJAX POST?

谁说胖子不能爱 提交于 2019-12-11 19:42:50
问题 I have an AJAX call in my javascript as - var obj = { CAEVCode:"TEST2", CAEVName:"TriggerRedemption", DateofReceipt:"YAHOO", LogReference:"test1" } var obj1=JSON.stringify(obj); $.ajax({ url:'./webapi/input/post', type: 'POST', data:obj1, contentType : "application/json", dataType:'json', success:function(data) { var values = JSON.stringify(data); alert(values); }, error:function(xhr,textstatus,errorthrown){ alert(xhr.responseText); alert(textstatus); alert(errorthrown); } },'json'); When the

URI for RESTful Web Services - Part 2

a 夏天 提交于 2019-12-11 17:52:21
问题 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/ <-- list of profiles domain.com/profiles/123/ <-- profile number 123 domain.com/profiles/123/likes/ <-- list of profile 123's likes domain.com/profiles/123/likes/2/ <-- 2nd item in the list of profile 123's likes Am I close or did I get this totally wrong? 回答1: Just think about whether your URLs provide meaningful operations for GET, POST,

RESTful API best practices for admin and normal user access

眉间皱痕 提交于 2019-12-11 12:35:27
问题 Having to create a RESTful web service with admin and normal user access to resources (lets say cars), I would like to structure the Uri for the users as: http://myhost/users/5/cars/2 But as admin user, I would like to access all cars like: http://myhost/cars/51 Instead of the first I proposed, would you think that it's better to use just one Uri for cars, using filters for users, like: http://myhost/cars/?user=5 To don't have 2 different Uris for the same resource? Do you have other

Three Step Buyonline The RESTful way

旧巷老猫 提交于 2019-12-11 06:38:46
问题 We are re-developing our buyonline functionality and we are doing it the RESTful way. The process is a three step one and the customer is asked to enter data at each step. Let's say the three URL's are; /step1.aspx /step2.aspx /step3.aspx Each step is pretty autonomous and don't require data from any of the other steps. The question is how do I stop customers directly navigating to step2 w/out first completing the details in step1 given each step knows nothing about the previous step? I know

Passing two values to the nested restful controller

ε祈祈猫儿з 提交于 2019-12-11 06:09:18
问题 In my nested restful controller my show method should receives two values like this public function show($postId, $commentsId) { // code } the generated url should be like this http://localhost/posts/1/comments/1 Now my query is: I need to send those twu value through my route call I am using like this : <a href="{{ URL::route('posts.comments.show', value1, value2) }}"> <h3> Click </h3></a> But it is giving an error like this Symfony \ Component \ Routing \ Exception \