2012-07-11 42 views
6

Swagger ile bir REST web API'sini belgeliyorum. Petstore örneğini indirdim.Swagger UI hatası: API Listeleme alınamadı

{ 
    "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" 
     } 
    ] 
} 

Ama benim web sunucusuna orijinal dosyaları yükleme sonrasında, Swagger UI söylüyor:

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 

bulmak değil Swagger neyin neden söyleyebilir O pet.json ve user.json başvuran resources.json oluşur json dosyam?

cevap

4

www.myserver.org adresine gideceğinizi ve swagger kullanıcı arabirimini getirdiğini varsayıyorum. Swagger UI'daki "Keşfet" metin kutusuna ... kaynaklarınızın yerini mutlaka yazın.

Ben şahsen benim dayı api belgeleri bu şekilde kurdunuz

...

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 

burada daha ayrıntılı bir açıklamasını keseblirsin - varsa Swagger With Static Documentation

daha fazla soru sormaya çekinmeyin.

İlgili konular