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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:17:36+00:00 2026-06-03T08:17:36+00:00

I am developing an api-like app that allows other applications to send requests which

  • 0

I am developing an api-like app that allows other applications to send requests which trigger a series of actions in the api-like application. I need to find a way to send large parameters (embed code) via url. I’m using Sinatra.

My first attempt: (Doesn’t work because embed code is not an acceptable url parameter)

get '/grab/:name/:bucket/:embed_code' do
  @video = Video.create(
    :name => params[:name],
    :bucket => params[:bucket],
    :embed_code => params[:embed_code],
    :created_at => Time.now
  )
  redirect "/video/#{@video.id}"
end

My second attempt: (Connection refused - connect(2) (Errno::ECONNREFUSED) Error)

# (get '/video_form') points to (post '/video') and post_form was supposed to trigger it

get '/video_form' do
  erb :new_video
end

post '/video' do
  @video = Video.create(
    :name => params[:name],
    :bucket => params[:bucket],
    :embed_code => params[:embed_code],
    :created_at => Time.now
  )
  redirect "/video/#{@video.id}"
end

Net::HTTP.post_form(URI.parse('http://localhost:4567/video_form'),{'name'=>'example_2', 'bucket' => 'bucket_name', 'embed_code' => '<iframe width="560" height="315" src="http://www.youtube.com/embed/ncL1UlvjiMQ" frameborder="0" allowfullscreen></iframe>'})
  • 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-03T08:17:37+00:00Added an answer on June 3, 2026 at 8:17 am

    A proper GET request might look like http://localhost/getit?embed=%3Ciframe%20width%3D%22560%22%20height%3D%22315%22%20src%3D%22youtube.com/embed/ncL1UlvjiMQ%22%3B%20frameborder%3D%220%22%20allowfullscreen%3E%3C/iframe%3E. For more information, read up on Encoding Query String Parameters. Quoting:

    Some characters cannot be part of a URL (for example, the space) and some other characters have a special meaning in a URL: for example, the character # can be used to further specify a subsection (or fragment) of a document; the character = is used to separate a name from a value. A query string may need to be converted to satisfy these constraints. This can be done using a schema known as URL encoding.

    In particular, encoding the query string uses the following rules:

    • Letters (A-Z and a-z), numbers (0-9) and the characters .,-,~ and _ are left as-is
    • SPACE is encoded as + or %20
    • All other characters are encoded as %FF hex representation with any non-ASCII characters first encoded as UTF-8 (or other specified encoding)

    You can try this yourself via:

    <form method="get" action="/getit">
      <input type="hidden" name="embed" value='<iframe width="560" height="315" src="youtube.com/embed/ncL1UlvjiMQ"; frameborder="0" allowfullscreen></iframe>'>
      <button>GO</button>
    </form>
    

    Notice that with this you don’t have to encode the value yourself; the web browser does that when it sends the form. Alternatively, you can make this GET request via JavaScript:

    var embed = '<iframe width="560" height="315" src="youtube.com/embed/ncL1UlvjiMQ"; frameborder="0" allowfullscreen></iframe>';
    location.href = "http://localhost/getit?embed="+escape(embed);
    

    A POST request doesn’t show up on the query string, but is encoded by the browser. Take the same HTML as above and change the method, and watch Sinatra receive it.

    To receive a complex parameter in Sinatra don’t try to make it part of the path, receive it as a proper parameter on the query string:

    get "/getit" do
      p params['embed']
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing an app (an API) in python and I would like to offer
I'm developing a web app based on videos that my client would like to
So I'm developing a small web app, that implements the Requests Dialog(User-to-User) . I'm
I am currently developing a web app that uses Google's Static Map API, in
I need to create some thing like prank call app so which API should
I'm currently developing a GUI for a Java-application that I've created. I would like
I am developing a web app in ASP.net that allows users to log in
I'm developing an iPhone app that takes advantage of Google search api and search
Developing a web application that I've registered with Twitter. In this app, I might
In developing an API, there is a requirement to provide custom request methods that

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.