Contents

Roo

HTTP.put()

Makes a simple HTTP PUT request to the specified URL. This is a convenience method to avoid having to construct a Request object manually. If your request needs to specify particular headers or cookies then constructing a Request object will be required.

HTTP.put(url as Text, content as Object, optional timeout as Integer) as Response

Parameters

  • url: Text object. The URL to make the PUT request to
  • content: Any object. The object will be converted to text before being assigned to the request’s content
  • timeout: Optional integer Number object. The number of seconds to wait before assuming that the request timed out. If not specified then a value of 10 seconds is used

Returns

Example

var content = {"id" => 1, "title" => "foo", "body" => "bar", "userId" => 1}
var response = HTTP.put("https://jsonplaceholder.typicode.com/posts/1", content)
JSON.parse(response.body) # {"id" => 1}