Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8247409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:50:24+00:00 2026-06-07T22:50:24+00:00

How would I make the following curl request in ruby? curl -k -X GET

  • 0

How would I make the following curl request in ruby?

curl -k -X GET -H "Content-Type: application/xml" -H "Accept: application/xml" -H "X-OFFERSDB-API-KEY: demo" 'http://testapi.offersdb.com/distribution/beta/offers?radius=10&postal_code=30305'

I’m having difficulty with some of the headers.

require 'net/http'

url = 'http://testapi.offersdb.com/distribution/beta/offers?radius=10&postal_code=30305'
mykey = 'demo'

request = Net::HTTP.new(url)
request.request_head('/', 'X-OFFERSDB-API-KEY' => mykey)

puts request
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T22:50:26+00:00Added an answer on June 7, 2026 at 10:50 pm

    I think you need to create a request object, instead of an HTTP object. Then set headers on it.

    require 'net/http'
    
    url = 'http://testapi.offersdb.com/distribution/beta/offers?radius=10&postal_code=30305'
    mykey = 'demo'
    uri = URI(url)
    
    request = Net::HTTP::Get.new(uri.path)
    request['Content-Type'] = 'application/xml'
    request['Accept'] = 'application/xml'
    request['X-OFFERSDB-API-KEY'] = mykey
    
    response = Net::HTTP.new(uri.host,uri.port) do |http|
      http.request(request)
    end
    
    puts response
    

    Source: http://ruby-doc.org/stdlib-1.9.3/libdoc/net/http/rdoc/Net/HTTPHeader.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to make a cycle over the following elements: [1,2,11,12,21,22,111,112,121,122,....,222222] or for
yes hi, i would like to make the variable in the following, (schoolsubjects) available
I would like to make my own user-mode NAT application. I have the folowing
i would make an application client server with java to change or modify the
How would I make the following calculator Class work?: //Calculator.h #import <Cocoa/Cocoa.h> @interface Calculator
I'm wanting to make an API quickly, following REST principles - for a simple
How would I make the following code work? <c:if test=${null != searchResults} > <c:forEach
I would like to make the following layout, see picture below, where the place
I would like to make the following code to be XAML: CData cData =
I use the following command in some old scripts: curl -Lk https:www.example.com/stuff/api.php? I then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.