Skip to content

Instantly share code, notes, and snippets.

@bastienrobert
Last active June 23, 2017 12:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bastienrobert/ad97a74841c112595a8ed7f9d13826a5 to your computer and use it in GitHub Desktop.
Save bastienrobert/ad97a74841c112595a8ed7f9d13826a5 to your computer and use it in GitHub Desktop.
require 'uri'
require 'net/http'
require 'json'
url = URI("http://api.stanleystella.com/webrequest/products/get_json")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
datas = {
"jsonrpc" => "2.0",
"method" => "call",
"params" => {
# Login informations
"db_name" => "production_api",
"user" => "MAIL ADDRESS",
"password" => "USER PASSWORD",
# Some random filters
"StyleCode" => "STTM528",
"ColorCode" => "C001"
},
"id" => 0
}
request.body = datas.to_json
response = http.request(request)
puts response.read_body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment