require 'http' require 'uri' require 'net/http'
uri = URI.parse("https://example.com/api/resource/123") request = Net::HTTP::Put.new(uri) request.content_type = "application/json" request.body = JSON.dump({"key" => "value"})
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end
puts response.code # print the response code puts response.body # print the response body
main.rb0 chars1 lines
gistlibby LogSnag