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

  • Home
  • SEARCH
  • 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 6891575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:25:39+00:00 2026-05-27T06:25:39+00:00

Like describe in API Goo.gl Manualy curl work perfectly : curl https://www.googleapis.com/urlshortener/v1/url \ -H

  • 0

Like describe in API Goo.gl

Manualy curl work perfectly :

curl https://www.googleapis.com/urlshortener/v1/url \
    -H 'Content-Type: application/json' \
    -d '{"longUrl": "http://www.rubyinside.com/"}'

Bu when i try to make this in Net::Http :

require "net/https"
require "uri"
uri = URI.parse("https://www.googleapis.com/urlshortener/v1/url")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(uri.path)
request["Content-Type"] = "application/json"
request.set_form_data({"longUrl" => "http://www.rubyinside.com/"})
response = http.request(request)
puts response.body

But fail with the response :

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "parseError",
    "message": "This API does not support parsing form-encoded input."
   }
  ],
  "code": 400,
  "message": "This API does not support parsing form-encoded input."
 }
}
 => nil

I see an another issue but seem does not work

This httparty sample code work but i want use net_http

  • 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-27T06:25:39+00:00Added an answer on May 27, 2026 at 6:25 am

    You have to send your data as json, not form encoded as you are trying to do. Try to change your code like so:

    ....
    require 'json'
    
    ....
    request.body = {"longUrl" => "http://www.rubyinside.com/"}.to_json
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use the google rest api, http://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=monkey&rsz=8 as described api spec here
I would like to describe some specifics of my program and get feedback on
I would like to stub the #class method of a mock object: describe Letter
I'd like to do something similar to what's described in http://www.bestbrains.dk/Blog/2010/03/25/HowToAssertThatYourSQLDoesNotDoFullTableScans.aspx but for that
I'm going to design a RESTful API soon, thus I need to describe it
i'm using the validation plugin from http://docs.jquery.com/Plugins/Validation i'd like to know if it is
Sites like ebay and amazon.com Know who you are with a message like Hello,
The link http://download.oracle.com/javase/6/docs/api/java/util/concurrent/package-summary.html describes several interesting data structures like concurrent skip-list. Is there any
Hi I'd like to describe a scenario I'd like to accomplish, and I have
Google News has API, described here: http://code.google.com/apis/newssearch/v1/index.html But it is a JavaScript API (client

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.