INTEGRATIONS / HTTP RECIPE

Vera, meet Ruby.

The generated Ruby example keeps the key in the environment and includes connection and read timeouts.

← All integrations

Your first connection.

  1. 01

    Use Ruby 3.1 or newer and set VERA_BASE_URL and VERA_API_KEY on the server.

  2. 02

    Copy the example into a script or service object; do not put the key in a browser bundle.

  3. 03

    Handle non-2xx responses before parsing or storing returned page data.

Build the request.

Set the environment variables in your terminal for these code examples. In automation tools, enter the URL and credentials in the tool’s own fields.

require "net/http"
require "uri"

uri = URI(ENV.fetch("VERA_BASE_URL").chomp("/") + "/api/vera/v1/scrape")
request = Net::HTTPGenericRequest.new("POST", true, true, uri.request_uri)
request["Authorization"] = "Bearer #{ENV.fetch("VERA_API_KEY")}"
request["Content-Type"] = "application/json"
request.body = "{\n  \"url\": \"https://example.com\"\n}"
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https", open_timeout: 10, read_timeout: 45) { |http| http.request(request) }
abort "Vera HTTP #{response.code}: #{response.body}" unless response.is_a?(Net::HTTPSuccess)
puts response.body

This edits a code example. It does not send a request or use credits.

Run a request in your workspace
YOUR PRIVACY

Choose what works for you. You can reopen these settings from the footer at any time.

Essential

Always active

Sign-in, security and preferences you ask us to remember. These keep the service working.

Analytics

Optional Vera visitor reporting counts visits and active browsers; Google Analytics may also measure selected clicks. We don’t send form contents, requested URLs, search queries, passwords, API keys or account emails. Turn it off here at any time.

Advertising

Not in use

No advertising cookies or remarketing tags.

Your choice is stored on this browser for 180 days. Read the cookie policy ↗