DELETE
Delete resource
DELETE
/resource/1
HTTP/1.1
Accept: */*
Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Host: example.com
User-Agent: rest-man/1.1.0 (darwin21 arm64) ruby/3.1.2p20
HTTP/1.1
200
OK
Content-Type: application/json
{
"message": "Resource with ID 1 has been deleted."
}
response = RestMan.delete "http://example.com/resource/1"
response.code #=> 200
response.headers #=> Hash
response.headers[:content_type] #=> application/json
response.body #=> {"message": ...}
response = RestMan.execute(method: :delete, url: "http://example.com/resource/1")
response.code #=> 200
response.headers #=> Hash
response.headers[:content_type] #=> application/json
response.body #=> {"message": ...}
resource = RestMan::Resource.new("http://example.com/resource/1")
resposne = resource.delete
response.code #=> 200
response.headers #=> Hash
response.headers[:content_type] #=> application/json
response.body #=> {"message": ...}
$ restman delete http://example.com/resource/1
{"message": ...}
Delete resource with custom headers
DELETE
/user/1
HTTP/1.1
Accept: */*
Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Host: example.com
User-Agent: rest-man/1.1.0 (darwin21 arm64) ruby/3.1.2p20
Authorization: Bearer token123
HTTP/1.1
200
OK
Content-Type: application/json
{
"message": "User with ID 1 has been deleted."
}
response = RestMan.delete "http://example.com/user/1", { authorization: "Bearer token123" }
response.code #=> 200
response.headers #=> Hash
response.headers[:content_type] #=> application/json
response.body #=> {"message": ...}
response = RestMan.execute(
method: :delete,
url: "http://example.com/user/1",
headers: {
authorization: "Bearer token123"
}
)
response.code #=> 200
response.headers #=> Hash
response.headers[:content_type] #=> application/json
response.body #=> {"message": ...}
resource = RestMan::Resource.new("http://example.com/resource/1")
resposne = resource.delete({authorization: "Bearer token123"})
response.code #=> 200
response.headers #=> Hash
response.headers[:content_type] #=> application/json
response.body #=> {"message": ...}
RestMan CLI hasn't support custom headers