Domain Availability Checker

PAID
By | Updated vor 14 Tagen | Tools
Popularity

9.3 / 10

Latency

1,907ms

Service Level

98%

Health Check

N/A

Back to All Discussions

Getting HTTP 400 when testing with Unirest and Ruby

Rapid account: Techie
techie
vor 8 Jahren

Hi,
I have written a simple request to the API using ruby but I get a HTTP 400 (bad request). Can you please help?
I have tested this with CURL, that works fine.
I am using the following version of ruby on Mac OSX El Capitan - ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]

=Ruby Code Below===

require 'unirest'
# These code snippets use an open-source library.
response = Unirest.post "https://domainstatus.p.mashape.com/", headers:{
"X-Mashape-Key" => "S6Kd4NibK4mshZ34TX0qAqBxM6tUp17qJZijsn0EIaKcQtquFH",
"Content-Type" => "application/json",
"Accept" => "application/json"
}
"{\"domain\":\"http://www.www.amazon.co.uk/whatever\"}"

puts response.code
puts response.headers
puts response.body
puts response.raw_body
Rapid account: Navii
navii Commented vor 7 Jahren

Sorry, Iā€™m not familiar with Ruby.

Join in the discussion - add comment below:

Login / Signup to post new comments