Created
March 7, 2014 10:48
-
-
Save sergio1990/9409385 to your computer and use it in GitHub Desktop.
Sample requesting information from API-NG betfair
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 'net/http' | |
require 'uri' | |
app_key = "YOUR_APP_KEY" | |
session_key = "YOUR_SESSION_ID" | |
uri = URI.parse("https://api-ng.betstores.com/betting/betfair/services/api.betfair.com/exchange/betting/json-rpc/v1") | |
http = Net::HTTP.new(uri.host, uri.port) | |
http.use_ssl = true | |
request = Net::HTTP::Post.new(uri.request_uri) | |
request.body = "{\"jsonrpc\": \"2.0\", \"method\": \"SportsAPING/v1.0/listCompetitions\", \"params\": {\"filter\": { }}}" | |
request["Content-Type"] = "application/json" | |
request["Accept"] = "application/json" | |
request["X-Application"] = app_key | |
request["X-Authentication"] = session_key | |
response = http.request request | |
puts response.body |
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
{"jsonrpc":"2.0","error":{"code":-32700,"message":"DSC-0008"}} |
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
{"jsonrpc":"2.0","result":[{"competition":{"id":"892425","name":"Czech 3. Liga"},"marketCount":40,"competitionRegion":"CZE"}, ...]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment