HTTP Status Code Lookup API - Ruby Gem
HTTP Status Code Lookup is a tool for looking up HTTP status code information. It provides descriptions, categories, and common causes for all standard HTTP status codes from 1xx to 5xx.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_httpstatuslookup'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_httpstatuslookup
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_httpstatuslookup'
# Initialize the client
client = APIVerve::Httpstatuslookup::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({ code: 404 })
# Print the response
puts response
Error Handling
begin
response = client.execute({ code: 404 })
puts response["data"]
rescue APIVerve::Httpstatuslookup::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Httpstatuslookup::APIError => e
puts "API error: #{e.}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Httpstatuslookup::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"code": 404,
"name": "Not Found",
"description": "The requested resource could not be found",
"category": "Client Error",
"is_error": true,
"is_success": false,
"is_redirect": false,
"is_informational": false
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://apiverve.com/marketplace/httpstatuslookup?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.