connect to box is failing using REST protocol but the same works using HTTP protocol

SOLVED
Go to solution
Highlighted
Occasional Contributor

connect to box is failing using REST protocol but the same works using HTTP protocol

Hi,

 For our application when we are using REST protocol to connect to BOX  , connection is failing with the bellow error:

 

https://api.box.com/2.0/search?query=Revised&file_extensions=pdf - Caught unhandled exception: java.lang.RuntimeException: org.apache.http.conn.ConnectTimeoutException: Connect to api.box.com:443 [api.box.com/107.152.27.197] failed...

 

 

When we are using HTTP protocol to connect to BOX , calls are going through without any error. Can someone please explain the reason behind this problem?

10 REPLIES 10
Highlighted
Trusted Contributor

Re: connect to box is failing using REST protocol but the same works using HTTP protocol

Did this just start happening today? There were some issues (supposedly since resolved) with the APIs earlier today--see http://status.box.com
Highlighted
Occasional Contributor

Re: connect to box is failing using REST protocol but the same works using HTTP protocol

I do not believe this is a BOX issue as I have one more application(hosted in my personal machine) using the exact codes( connect to box using HTTP and REST) and that one seems to be working. The one having problem is hosted in cloud . I kind of sense that this might be a network/firewall issue of the cloud server. 

Tags (1)
Highlighted
Trusted Contributor

Re: connect to box is failing using REST protocol but the same works using HTTP protocol

Well, starting from the basics, can you open a telnet connection to api.box.com on port 443 (i.e. 'telnet api.box.com 443') from the machine running your code? If not, it's almost definitely a firewall or connectivity issue of some sort.
Highlighted
Occasional Contributor

Re: connect to box is failing using REST protocol but the same works using HTTP protocol

This is the reply I got back from our network admin.

--telnet wont be possible as we go outside using a proxy
--I can do curl and access the api.box URL
--the curl command allows to set a proxy.

 

After he ran the curl command , we got response back:

 

[root@lvappi01351 ~]# export https_proxy=gateway.bns:443
[root@lvappi01351 ~]# curl https://api.box.com
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https://developers.box.com/">here</a>.</p>
</body></html>
[root@lvappi01351 ~]#

 

 

 

Highlighted
Trusted Contributor

Re: connect to box is failing using REST protocol but the same works using HTTP protocol

Sounds to me like the proxy is almost definitely the issue. Are all the hosts/ports listed at https://community.box.com/t5/How-to-Guides-for-Account/Configuring-A-Firewall-For-Box-Applications/t... properly set up and proxied?
Highlighted
Occasional Contributor

Re: connect to box is failing using REST protocol but the same works using HTTP protocol

we will be performing a network trace to find out where does the call fail. Only confusing part is that when we are using HTTP protocol , then connection is successful. Using REST protocol is causing the problem.

Highlighted
Trusted Contributor

Re: connect to box is failing using REST protocol but the same works using HTTP protocol

Well, all RESTful API calls go to Box over HTTPS.  My guess is that there's something about your firewall/proxy setup that is blocking the connection from the machine you're running your code to the HTTPS ports on the right machine at Box.  If opening things up to the list of hosts that  I linked to earlier in this thread doesn't work, I'd contact Box support directly (via Contact Box Support) to see if they have any more specific guidance about what needs to be opened/proxied to allow the API calls to work.

Highlighted
Occasional Contributor

Re: connect to box is failing using REST protocol but the same works using HTTP protocol

The root cause of our problem was the source code from our vendor(Pega). It seems the because of the bug any rest call made from the app using proxy( we have set up a proxy setting on our app server and all the calls should use the proxy configuration) , was bypassing the proxy settings. after the source was updated , all the rest calls are now going through proxy and are successful.

Highlighted
Trusted Contributor

Re: connect to box is failing using REST protocol but the same works using HTTP protocol

Great! Glad to hear you figured it out!

Ian
Highlighted
First-time Contributor

Re: connect to box is failing using REST protocol but the same works using HTTP protocol

Can you send the documentation of the REST box?