Created
January 28, 2013 22:55
-
-
Save pgroudas/4660070 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 'net/http' | |
require 'json' | |
auth_token = '<put_the_auth_token_you_get_back_here>' | |
search_endpoint = 'http://localhost:5000/listing/' | |
login_endpoint = 'http://localhost:5000/login' | |
json = JSON.dump( | |
{ | |
"email"=>"foo@urbancompass.com", | |
"password"=>"password" | |
} | |
) | |
#uri = URI.parse(login_endpoint) | |
uri = URI.parse(search_endpoint) | |
# Full control | |
http = Net::HTTP.new(uri.host, uri.port) | |
request = Net::HTTP::Post.new(uri.request_uri) | |
request.body=json | |
# We are going to move to an 'api-version' header shortly, as well as adding a 'response-type' get parameter | |
request['content-type'] = 'application/json' | |
request['Authentication-Token'] = auth_token | |
response = http.request(request) | |
puts response.body |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment