Http request is not giving the proper response

I want to use Sketchup http request for my plugin.
Url is
When I am hitting it on browser I’m getting a response
{“error”:“Api key is missing”}

But when I’m executing it through sketchup api. Status code is 0 and body is empty

request ='', Sketchup::Http::GET)      
request.start do |request, response|
  puts "Sentio http status code: #{response.status_code} body #{response.body}."

What am I missing here ?

@DanRathbun - Can you please help me on this .

I could not get a lot of debug info from SketchUp’s HTTP API, but you can still try different implementations to see if something is wrong with your request (irb with “net/http” or “open-uri”).

Your server is configured to redirect to https, which is a problem for some http libraries that don’t follow redirects (“301 Moved Permanently”).

Then when changing the url to https, ssl verification fails (even the browser gives “Invalid certificate” and wants me to confirm that).

Aerilius has you on the right track. Maybe this additional info will help: When a trusted web site, e.g. ‘’, is substituted for your link, the code works and produces the html body.

Your site is not trusted. Using the Chrome browser and just clicking on your link to ‘…/plans’, gives me this scary message:

Your connection is not private
Attackers might be trying to steal your information from (for example, passwords, messages, or credit cards). …

This server could not prove that it is; its security certificate is not trusted by your computer’'s operating system. This may be caused by a misconfiguration or an attacker intercepting your connection.

1 Like

@Aerilius and jimvjohn
Thanks guys . The problem was indeed on my server.
Thank you again for helping me out.

No sorry cannot. I don’t use SU2017, do not have a website, do not use this class.

Best to search the forums on what @tt_su or @thomthom has said about this.
(You just put “user:username” in the search terms, no quotes however.)

Ex: … a search on "user:tt_su http"

To debug HTTP requests you can use utilities such as Fiddler:

You mention that when you visit with the browser it says {“error”:“Api key is missing”}. This indicates that you are missing a parameter to the request.

You might want to also inspect the headers of the response.

That being said, when I visit the API url from Chrome I get a message the Chrome is denying the connection:

It appear to be redirecting to HTTPS and the certificate isn’t valid.
The Http classes uses Chromiums to perform the requests - so I’m guessing that might also cause the request to be denied here.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.