Linked Questions
16 questions linked to/from Should a RESTful 'PUT' operation return something....
31
votes
3
answers
14k
views
How to return generated ID in RESTful POST?
Let's say we have a service to add a new hotel:
> POST /hotel
> <hotel>
> <a>aaa</a>
> <b>aaa</b>
> <c>aaa.......this is 300K</c>
> &...
10
votes
2
answers
8k
views
JQuery ajax call executes error on 200 [duplicate]
My c#/WebApi server code looks like:
[HttpPost]
public HttpResponseMessage Logout()
{
// do some stuff here ...
return Request.CreateResponse(HttpStatusCode.OK);
}
In the client I do an ajax ...
4
votes
2
answers
7k
views
return newly generated id restful service post
I'm trying to edit my create method in my REST webservice so it should return the newly created ID from the object. I've been trying for the past two days but I must be doing something terribly wrong.....
0
votes
1
answer
2k
views
Response code for HTTP PUT with empty data
What is the most common/industry standard response code for HTTP PUT when:
Client made a well-formed request and
The content of the file/message/data is empty and
Because of that nothing has been ...
1
vote
1
answer
2k
views
Put request in ajax
I have a route like this --
Route::put('avote', 'voteController@avote')->middleware('auth');
I want to access this route from a ajax send request.
When i use this code --
$data = {/* some data ...
4
votes
2
answers
2k
views
RESTful APIs: what to return when updating an entity produces side-effects
One of our APIs has a tasks resource. Consumers of the API might create, delete and update a given task as they wish.
If a task is completed (i.e., its status is changed via PUT /tasks/<id>), a ...
3
votes
2
answers
2k
views
REST optimistic-locking and multiple PUTs
Far as I understand, PUT request is not supposed to return any content.
Consider the client wants to run this pseudo code:
x = resource.get({id: 1});
x.field1 = "some update";
resource.put(x);
x....
1
vote
2
answers
2k
views
Is it ok to return a real entity when working with DTO's [closed]
For example, I need to update an EntityA. As I am working with DTO's, user needs to transfer DTO for update in Controller. In service layer I extract Entity and update it with DTO fields, then - save ...
1
vote
0
answers
1k
views
Return a modified object in a REST PUT
I am implementing a REST api for setting and retrieving a resource.
I have been asked to implement a strange PUT, whereby a JSON object is stored, while another JSON object is returned.
PUT /object/{...
1
vote
1
answer
702
views
Meaning that 'PUT method: Successful response has body' in the MDN document
I don't understand below sentence in MDN Document about PUT.
Successful response has body No
as if there was a response body, of course.
Because most of the other documents say it's possible, ...
-1
votes
2
answers
662
views
What Http code should I return when replacing a resource (file)
I searched "HTTP code for replacing a resource" on Google but it really messes up with the keywords and don't give me the desired results. I have a file upload API and an interface that users interact ...
0
votes
1
answer
283
views
Json put/get/post in Restful webservices not working
I am trying to pass parameters to a server and extract the report in csv format. So the code i have has PUT/GET/POST in the order. I could get GET and POST work, but when i add PUT there is no error ...
0
votes
1
answer
181
views
should I return the entire record again as a response from server to a POST when I do $update on an angular resource?
In my factory
return $resource('rest/records/:id', {}, {
query: {
method: 'GET',
isArray: true,
// RestSQL has an extra struct around the array
...
1
vote
1
answer
115
views
knockoutjs should I rebind after update
If I have an observableArray and update one if the items using AJAX PUT (or PATCH) to a WebAPI method, should I either
Just leave it at that assuming there are no errors.
Send back the updated entity ...
0
votes
1
answer
74
views
Correct HTTP status code for PUT/POST method that does not update the document
I have a HTTP PUT/POST method to update a document in the database. However, in certain conditions (for example, the input transaction timestamp is less than the timestamp on the document), the PUT/...