Forum Discussion

deeptigarg's avatar
deeptigarg
New Contributor
8 years ago

Not able to execute API from SwaggerHub

Hi,

 

I am new to SwaggerHub and having trouble accessing the API that I created using an existing swagger.yaml file on SwaggerHub.

 

I have specified the host name as my machine name (which is part of my office network and accessible via VPN) in the swagger.yaml

 

I am able to publish my API and when I go to 'Interactive API Doc' I see the endpoints listed as expected. However when I try any endpoint I get the following:

 

Response Body: getaddrinfo ENOTFOUND my_machine_name my_machine_name:port

Response Code: 500.

 

Following is the request URL:

https://app.swaggerhub.com/proxy/?url=http%3A%2F%2Fmy_machine_name%3Aport%2FfindMetrosByState&proxy-token=tmmt8ju

 

I generated the swagger yaml file using swagger-maven-plugin and have annotated my endpoints with a @ApiOperation annotation.

 

Please let me know if I need to provide any more information.

Appreciate any help on this.

 

Thanks,
Deepti

  • Hi!  SwaggerHub executes requests through a proxy on our server so we can deal with the challenges of CORS, etc.  So the request actually does go through our server.

     

    That means that if your server is inside your firewall (i.e. unreachable from the internet), you will _not_ be able to call it directly through SwaggerHub.  We will be adding a feature to disable the proxy (or use a custom one) but that's not yet available. 

  • fehguy's avatar
    fehguy
    8 years ago

    Hi, you can certainly call your API if it's external.  Just set the `host` and `basePath` fields and it will call those external services.  Please post back with any questions!

  • Hi!  SwaggerHub executes requests through a proxy on our server so we can deal with the challenges of CORS, etc.  So the request actually does go through our server.

     

    That means that if your server is inside your firewall (i.e. unreachable from the internet), you will _not_ be able to call it directly through SwaggerHub.  We will be adding a feature to disable the proxy (or use a custom one) but that's not yet available. 

    • deeptigarg's avatar
      deeptigarg
      New Contributor

      Hi Tony...thanks for the speedy reply.

       

      Follow-up question: does this mean that in order to access my endpoints using SwaggerHub, I will need to host my API on some cloud service, like Amazon AWS or Microsoft Azure? Please let me know.

       

      Thanks!

      • fehguy's avatar
        fehguy
        Staff

        Hi, you can certainly call your API if it's external.  Just set the `host` and `basePath` fields and it will call those external services.  Please post back with any questions!

    • marrotte's avatar
      marrotte
      New Member

      Was the disable proxy ever added?  If so, how is it accessed?

      • ShannonWallace's avatar
        ShannonWallace
        SmartBear Alumni (Retired)

        Hi there,

         

        Interesting timing, we are working on this now! We expect to be releasing this in a couple of weeks. There will be a USE BROWSER | USE PROXY toggle at the very bottom of the docs view in SwaggerHub (swagger-ui view).

         

        I'm glad it sounds like this will help you!

  • Hi!  SwaggerHub executes requests through a proxy on our server so we can deal with the challenges of CORS, etc.  So the request actually does go through our server.

     

    That means that if your server is inside your firewall (i.e. unreachable from the internet), you will _not_ be able to call it directly through SwaggerHub.  We will be adding a feature to disable the proxy (or use a custom one) but that's not yet available.