-
Notifications
You must be signed in to change notification settings - Fork 0
PUT Method
Using the PUT method you usually manipulate an existing resource. You should think of an update of some information of the resource you firing the request at.
If a resource doesn't exist already, put will create it. So put is also another method to create resources. But never the less it shouldn't be used to create. Use it to update resources.
Usage:
//initialize REST client
var client = new REST();
//fire request
client.PUT(url,true,body,function (responseText, statusCode, statusMessage) {
//do something ...
});PUT method uses four parameters:
- url
- boolean
- body
- callback function
Most of the methods you already familiar with from the previews pages but body. Body is a new resource which will contain different information than the already existing resource. If the request is executed the resource given as body will replace the existing one.
Note: This is not a save method. You should provide a mechanism on the rest service to make sure this request is a valid manipulation.