No "Try it out" button

1,819 views
Skip to first unread message

SwagIt

unread,
Jan 27, 2015, 8:28:19 PM1/27/15
to swagger-sw...@googlegroups.com
I was trying to configure swagger with with simple app on tomcat.
Swagger ui is working and I can see my service though there is no option to try the service like there is on the sample pet store app.
I am new to swagger and might be wrong in configuration.

Can you please advise what to check.

tony tam

unread,
Jan 28, 2015, 12:48:33 AM1/28/15
to swagger-sw...@googlegroups.com
Hi, you can configure what operations you want to enable--such as get, put, post, delete--with this setting:


      window.swaggerUi = new SwaggerUi({
        url
: url,
        dom_id
: "swagger-ui-container",
        supportedSubmitMethods
: ['get', 'post', 'put', 'delete'],

If set to an empty array, it should allow all operations.

rajesh.cha...@honeywell.com

unread,
Jan 28, 2015, 7:57:11 AM1/28/15
to swagger-sw...@googlegroups.com

Hi,

I am also facing the same problem, where I am able to view the API's but I am not able to edit the input parameters and "Try it out!" button itself is not visible. Its like the page is Read Only..

Is there any configuration that needs to be implemented on the API side to enable testing from UI?

Please advice.

Thanks,

Rajesh.

SwaggerIt

unread,
Jan 28, 2015, 8:55:26 AM1/28/15
to swagger-sw...@googlegroups.com
I have just copied the index.html from swagger ui project and it does have all the methods.
everything seems to be displayed, except there is no "Try it out button" or option to input data to call api.

<script type="text/javascript">

    $(function () {

      var url = window.location.search.match(/url=([^&]+)/);

      if (url && url.length > 1) {

        url = url[1];

      } else {

        url = "http://localhost:8080/TopCoder/rest/api-docs";

      }

      window.swaggerUi = new SwaggerUi({

        url: url,

        dom_id: "swagger-ui-container",

        supportedSubmitMethods: ['get', 'post', 'put', 'delete'],

        onComplete: function(swaggerApi, swaggerUi){

          log("Loaded SwaggerUI");

          if(typeof initOAuth == "function") {

            /*

            initOAuth({

              clientId: "your-client-id",

              realm: "your-realms",

              appName: "your-app-name"

            });

            */

          }

          $('pre code').each(function(i, e) {

            hljs.highlightBlock(e)

          });

        },

        onFailure: function(data) {

          log("Unable to Load SwaggerUI");

        },

        docExpansion: "none",

        sorter : "alpha"

      });


      function addApiKeyAuthorization() {

        var key = $('#input_apiKey')[0].value;

        log("key: " + key);

        if(key && key.trim() != "") {

            log("added key " + key);

            window.authorizations.add("api_key", new ApiKeyAuthorization("api_key", key, "query"));

        }

      }


      $('#input_apiKey').change(function() {

        addApiKeyAuthorization();

      });


      // if you have an apiKey you would like to pre-populate on the page for demonstration purposes...

      /*

        var apiKey = "myApiKeyXXXX123456789";

        $('#input_apiKey').val(apiKey);

        addApiKeyAuthorization();

      */


      window.swaggerUi.load();

  });

  </script>

SwaggerIt

unread,
Jan 28, 2015, 1:14:33 PM1/28/15
to swagger-sw...@googlegroups.com
Can someone help, or advise if I need to open issue for this problem,
It seems problem mentioned by me/Rajesh in this thread are same so looks repeating. 
a documented solution here would certainly help other users.

Ron Ratovsky

unread,
Jan 28, 2015, 1:16:43 PM1/28/15
to swagger-sw...@googlegroups.com
If your deployment is public, can you share a URL?

If not, can you share a screenshot showing the problem?

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------
Message has been deleted

Ron Ratovsky

unread,
Jan 28, 2015, 4:53:18 PM1/28/15
to swagger-sw...@googlegroups.com
Can you check which version of the ui you're using?
You can look at the top of the swagger-ui.js file.

On Wed, Jan 28, 2015 at 1:32 PM, SwaggerIt <raj...@gmail.com> wrote:

Please see screenshot attached.

On Wednesday, January 28, 2015 at 12:16:43 PM UTC-6, Ron wrote:
If your deployment is public, can you share a URL?

If not, can you share a screenshot showing the problem?
On Wed, Jan 28, 2015 at 10:14 AM, SwaggerIt <raj...@gmail.com> wrote:
Can someone help, or advise if I need to open issue for this problem,
It seems problem mentioned by me/Rajesh in this thread are same so looks repeating. 
a documented solution here would certainly help other users.


On Tuesday, January 27, 2015 at 7:28:19 PM UTC-6, SwaggerIt wrote:
I was trying to configure swagger with with simple app on tomcat.
Swagger ui is working and I can see my service though there is no option to try the service like there is on the sample pet store app.
I am new to swagger and might be wrong in configuration.

Can you please advise what to check.

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

SwaggerIt

unread,
Jan 28, 2015, 4:54:17 PM1/28/15
to swagger-sw...@googlegroups.com

// swagger-ui.js

// version 2.1.0-alpha.7


On Wednesday, January 28, 2015 at 3:53:18 PM UTC-6, Ron wrote:
Can you check which version of the ui you're using?
You can look at the top of the swagger-ui.js file.
On Wed, Jan 28, 2015 at 1:32 PM, SwaggerIt <raj...@gmail.com> wrote:

Please see screenshot attached.

On Wednesday, January 28, 2015 at 12:16:43 PM UTC-6, Ron wrote:
If your deployment is public, can you share a URL?

If not, can you share a screenshot showing the problem?
On Wed, Jan 28, 2015 at 10:14 AM, SwaggerIt <raj...@gmail.com> wrote:
Can someone help, or advise if I need to open issue for this problem,
It seems problem mentioned by me/Rajesh in this thread are same so looks repeating. 
a documented solution here would certainly help other users.


On Tuesday, January 27, 2015 at 7:28:19 PM UTC-6, SwaggerIt wrote:
I was trying to configure swagger with with simple app on tomcat.
Swagger ui is working and I can see my service though there is no option to try the service like there is on the sample pet store app.
I am new to swagger and might be wrong in configuration.

Can you please advise what to check.

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsubscri...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ron Ratovsky

unread,
Jan 28, 2015, 5:05:25 PM1/28/15
to swagger-sw...@googlegroups.com
And do you use a Swagger 1.2 or 2.0 definition?

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

SwaggerIt

unread,
Jan 28, 2015, 5:16:51 PM1/28/15
to swagger-sw...@googlegroups.com
That was my clue. Reverting swagger ui to 2.0.24 stable release resolved this for me.
Thanks Ron.

Ron Ratovsky

unread,
Jan 28, 2015, 5:19:01 PM1/28/15
to swagger-sw...@googlegroups.com
Yeah, sorry about that. Apparently we have a bug related to it. Tony just found the issue and is fixing it. Watch out for an update.

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Ron Ratovsky

unread,
Jan 28, 2015, 5:22:41 PM1/28/15
to swagger-sw...@googlegroups.com
You can pull master again, should be fixed. Tony is awesome and fixed it in like 2 seconds.

tony tam

unread,
Jan 28, 2015, 5:24:04 PM1/28/15
to swagger-sw...@googlegroups.com
took a long time to break it, though.

rajesh.cha...@honeywell.com

unread,
Jan 29, 2015, 4:11:36 AM1/29/15
to swagger-sw...@googlegroups.com
Thanks Tony and Ron for the quick fix.

The updated code displays the Try it Out! button. 

Karthik Sundaram

unread,
Jan 29, 2015, 2:37:45 PM1/29/15
to swagger-sw...@googlegroups.com
thanks! stitch in time...(for me at least!)
Reply all
Reply to author
Forward
0 new messages