Last active
June 23, 2017 12:54
-
-
Save bastienrobert/ad97a74841c112595a8ed7f9d13826a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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