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 7431241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:15:54+00:00 2026-05-29T09:15:54+00:00

I need to develop a small Rails app that makes a request to an

  • 0

I need to develop a small Rails app that makes a request to an JSON API, introducing the parameters into an initial form, check if we get a real response and then render the results into a view (html.erb).

Do you know where can I get good material to do these steps? Any help is welcome.

I’m reading some near example:

    params_string = "whatever"
    params_string_with_api_key = params_string + "&" + @@API_KEY
    hashkey = Digest::SHA1.hexdigest(params_string_with_api_key)
    params_string += "&hashkey=#{hashkey}"

    res = Net::HTTP.get_response("api.somecompany.com", "/some/url.json?#{params_string}")

    res_sha1 = Digest::SHA1.hexdigest(res.body + @@API_KEY)

    @verified = res["X-Somecompany-Response-Signature"] == res_sha1

    parsed_json = ActiveSupport::JSON.decode(res.body)
    @results = parsed_json["results"]

Is it always needed to encode the parameters string when you do the Net::HTPP request? Is there another way?

What does exactly params_string += "&hashkey=#{hashkey}"?

Thank you!

  • 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-05-29T09:15:55+00:00Added an answer on May 29, 2026 at 9:15 am

    What does exactly params_string += “&hashkey=#{hashkey}”?

    params_string is a string that looks like ?param1=val&param2=val2.... Your last piece of code is just appending another param to the string. If your issue is with the #{} fragment, this syntax, in a ruby double-quoted string, allows you to use the value of a var.

    Is it always needed to encode the parameters string when you do the Net::HTPP request? Is there another way?

    I don’t see the parameters string being encoded here. All I see is a checking of the results, done by comparing a response header with a SHA1’d response body.

    Not really related to your questions : I went away from Net::HTTP a while back, having troubles with segfault. I now use Typhoeus for all requests through the network.

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

Sidebar

Related Questions

I have an existing website that I need to develop a small portion of
I need to develop a small game that should use SVG elements. I know
I'm trying to develop small app that will be registered on PhoneStateListener and do
I need to develop a small Flex application that needs to access a MySQL
I'm planning to develop a small business app that I'd like to be deployable
I need to develop a small-medium sized desktop GUI application, preferably with Python as
I'm looking to develop a small application on Mac OSX and it will need
I need to develop a process that will detect if the users computer has
I need to write a small tool that parses a textual input and generates
The Unix philosophy teaches that we should develop small programs that do one thing

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.