Can't make requests from the API Documentation

Those who have tried to make a API call from either or qa-refapp may have experienced it.

The reason is that the host name of the Swagger Spec is invalid. The problem possibly is in here, which always returns the ip of the localhost (

If others could confirm, we can work on a fix.

How does one reproduce the problem?

Login to

Then visit apiDocs page.

Then make any valid request by clicking one of try out buttons.

One could try GET /drug. Once you made the request, there will be no response from the server as the request is sent to an invalid url.

For instance /drug, what is the invalid url, and what should the correct one be?

I also noticed that for getting drugs, the Model Example Value here!/drug/getAllDrugs is different from the one here:!/drug/getAllDrugs Did it get messed up?

No I mean when making a request. Once clicked on the try out button. It is nothing to do with the drug resource.

Requests are sent to It is being always that way. So one can only make a request when running from localhost.

I do not seem to understand. Do you mind just answering the two questions i put above? :slight_smile:

This is what I see when I invoke GET /app from

As shown in the picture request is sent to The correct request url should be

I guess that one fix for this is to set the global property for the REST API root url on that server. Maybe it’s not set?

It is to do with the host parameter of the swagger spec.

If you check in here:, you’ll see “host” is set to “” and “schemes” to [ “http” ]. Here in case with qa-refapp, both values are invalid.

I think the simplest solution will be to simply omit host, and schemes params from the spec as suggested in here.

Omitting host and scheme

host and scheme can be omitted for a more dynamic association. In this case, the host and scheme used to serve the API documentation will be used for API calls. For example, if Swagger UI-based documentation is hosted at, “try it out” API calls will be directed to

BTW I’m not really sure what do you mean by ‘REST API root url’ .

I was talking about the global property mentioned here.

This is used elsewhere in the REST module (e.g. when generating links in resources) to let you use a different URI than what the request is reporting. So maybe the correct fix is to use that GP in generating the swagger spec also.

(Or maybe leaving it blank will work fine. I don’t know if that’s allowed, or anything about swagger specs myself.)

Thanks for the information.

Here it is probably returning As shouldn’t be used as the host param of the spec, we should replace it with either servers domain name or the remote ip.

May be @pascal will have an idea whether we should omit these (host and schemes) or not.

Can we get the value of in the format instead of ? is not helpful in this case. We either need the domain or the remote ip.

I would say that for now, fix it with what you think is best. Then later on when others comment, you can always revisit it.

The value of is supposed to be the external IP that consumers of the REST API would use. I.e. it should be set to