I'm documenting a REST web API with Swagger. I've downloaded the petstore example. It consists of the resources.json
which references 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 uploading the original files to my web server, 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 what causes Swagger not find my json file?
I'm assuming you're going to www.myserver.org and it brings up the swagger ui? In the "Explore" textbox in the Swagger UI... be sure to type in the location of your resources.json.
I personally have my swagger api documentation set up 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 checkout a more detailed explaination here - Swagger With Static Documentation
If you have any more questions feel free to ask.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With