Update an existing record in the database and notify subscribed sockets that it has changed.
PUT /:model/:id
This updates the record in the model which matches the id parameter and responds with the newly updated record as a JSON dictionary. If a validation error occurred, a JSON response with the invalid attributes and a 400
status code will be returned instead. If no model instance exists matching the specified id, a 404
is returned.
Attributes to change should be sent in the HTTP body as form-encoded values or JSON.
Parameter | Type | Details |
---|---|---|
model | The identity of the containing model. e.g. 'product' (in PUT /product/5 ) |
|
id | The primary key value of the record to update. e.g. '5' (in PUT /product/5 ) |
|
* | For POST (RESTful) requests, pass in body parameters with the same name as the attributes defined on your model to set those values on the desired record. For GET (shortcut) requests, add the parameters to the query string. |
|
callback | If specified, a JSONP response will be sent (instead of JSON). This is the name of the client-side javascript function to call, passing results as the first (and only) argument e.g. ?callback=myJSONPHandlerFn |
Change Applejack's hobby to "kickin":
PUT /pony/47
{
"hobby": "kickin"
}
{
"hobby": "kickin",
"id": 47,
"name": "AppleJack",
"createdAt": "2013-10-18T01:23:56.000Z",
"updatedAt": "2013-11-26T22:55:19.951Z"
}