gistlib
You can make an HTTP PATCH request in Ruby using the httparty gem. Here's an example:
httparty
main.rbrequire 'httparty' response = HTTParty.patch('https://example.com/api/resource', headers: { 'Content-Type' => 'application/json' }, body: { key: 'value' }.to_json) if response.success? puts 'Resource updated!' else puts 'There was an error updating the resource.' end 326 chars12 lines
require 'httparty' response = HTTParty.patch('https://example.com/api/resource', headers: { 'Content-Type' => 'application/json' }, body: { key: 'value' }.to_json) if response.success? puts 'Resource updated!' else puts 'There was an error updating the resource.' end
In this example:
https://example.com/api/resource
Content-Type
application/json
gistlibby LogSnag