Swagger user interface error: unable to get API list

I am documenting a REST web API with Swagger . I downloaded the petstore example. It consists of resources.json , which refers to pet.json and user.json :

 { "apiVersion":"0.2", "swaggerVersion":"1.0", "basePath":"http://petstore.swagger.wordnik.com/api", "apis": [ { "path":"/pet.{format}", "description":"Operations about pets" }, { "path":"/user.{format}", "description":"Operations about user" } ] } 

But even after downloading the source files to my web server, the Swagger UI tells me:

 Unable to fetch API Listing. Tried the following urls: http://www.myserver.org/resources.json http://www.myserver.org http://www.myserver.org/resources.json http://www.myserver.org/resources 

Can you tell me what reasons Swagger does not find my json file?

+6
source share
1 answer

I assume you go to www.myserver.org and it raises the swagger ui? In the Explore text box in the Swagger user interface, be sure to specify the location of your resources. Json

I personally have my own api documentation created this way ...

 http://adamclerk.com/api --Swagger UI http://adamclerk.com/api/doc --returns json representing resources.js http://adamclerk.com/api/doc/donuts --returns json representing donut operations 

you can check a more detailed explanation here - Swagger With Static Documentation

If you have any more questions, feel free to ask.

+4
source

Source: https://habr.com/ru/post/920257/


All Articles