Google app engine 为什么部署时没有显示我的API?
我怀疑这是由端点中的以下错误(如果有效)引起的,但我也肯定在某些地方有解决方法 复制步骤:Google app engine 为什么部署时没有显示我的API?,google-app-engine,google-cloud-endpoints,Google App Engine,Google Cloud Endpoints,我怀疑这是由端点中的以下错误(如果有效)引起的,但我也肯定在某些地方有解决方法 复制步骤: 更改终结点类中的方法名称、方法的API名称或参数列表 运行endpoints.sh脚本以生成API文件 在本地检查API文件并见证更改。到目前为止还不错 部署到服务器上应用程序的默认版本 检查对/_ah/spi/BackendService.getApiConfigs的调用日志。没有错误 转到API资源管理器并清除浏览器缓存。检查API。变化并不存在 直接在浏览器中请求API文件,例如https://[
@Api(name = "ditto", version = "v1")
public class CategoryEndpoint extends BaseEndpoint {
@SuppressWarnings("unused")
private static final Logger log = Logger.getLogger(CategoryEndpoint.class.getName());
@ApiMethod(name = "category.list")
public WireCategory list() {
Category root = categoryDao.getRoot();
WireCategory wireRootCategory = new WireCategory(root);
return wireRootCategory;
}
}
下面是生成的.api文件:
{
"extends" : "thirdParty.api",
"abstract" : false,
"root" : "https://1.eliot-dev-uk-ditto-do.appspot.com/_ah/api",
"name" : "ditto",
"version" : "v1",
"defaultVersion" : false,
"adapter" : {
"bns" : "https://1.eliot-dev-uk-ditto-do.appspot.com/_ah/spi",
"deadline" : 10.0,
"type" : "lily"
},
"auth" : {
"allowCookieAuth" : false
},
"frontendLimits" : {
"unregisteredUserQps" : -1,
"unregisteredQps" : -1,
"unregisteredDaily" : -1,
"rules" : [ ]
},
"cacheControl" : {
"type" : "no-cache",
"maxAge" : 0
},
"methods" : {
"ditto.category.list" : {
"path" : "list",
"httpMethod" : "GET",
"scopes" : [ ],
"audiences" : [ ],
"clientIds" : [ ],
"rosyMethod" : "ditto.api.CategoryEndpoint.list",
"request" : {
"body" : "empty"
},
"response" : {
"body" : "autoTemplate(backendResponse)"
}
}
},
"descriptor" : {
"schemas" : {
"WireCategory" : {
"id" : "WireCategory",
"type" : "object",
"properties" : {
"webSafePath" : {
"type" : "string"
},
"prettyPath" : {
"type" : "string"
},
"children" : {
"type" : "array",
"items" : {
"$ref" : "WireCategory"
}
},
"path" : {
"type" : "array",
"items" : {
"type" : "string"
}
},
"name" : {
"type" : "string"
},
"id" : {
"type" : "string",
"format" : "int64"
}
}
}
},
"methods" : {
"ditto.api.CategoryEndpoint.list" : {
"response" : {
"$ref" : "WireCategory"
}
}
}
}
}
这个URL给了我一个404,我希望在这里看到我的API JSON:
这简直要了我的命
编辑:
我刚刚发现了AppEngine1.7.5和1.7.6生成的.api文件之间的差异。不知道为什么URL发生了变化
ditto-v1.api from 1.7.6:
{
"extends" : "thirdParty.api",
"abstract" : false,
"root" : "https://1.eliot-dev-uk-ditto-do.appspot.com/_ah/api",
"name" : "ditto",
"version" : "v1",
"defaultVersion" : false,
"adapter" : {
"bns" : "https://1.eliot-dev-uk-ditto-do.appspot.com/_ah/spi",
"deadline" : 10.0,
"type" : "lily"
}
...
ditto-v1.api from 1.7.5:
{
"extends" : "thirdParty.api",
"abstract" : false,
"root" : "https://eliot-dev-uk-ditto-do.appspot.com/_ah/api",
"name" : "ditto",
"version" : "v1",
"defaultVersion" : false,
"adapter" : {
"bns" : "http://eliot-dev-uk-ditto-do.appspot.com/_ah/spi",
"deadline" : 10.0,
"type" : "lily"
}
...
正如您已经指出的,这是由于SDK 1.7.6中存在一个奇怪的问题,它在.api文件的端点根url的开头添加了
1.
我尝试了新的SDK 1.7.7,它似乎已经解决了…我们认为这是一个与的问题,我们正在试图找到问题的根源。您是否有类似的问题?切换回1.7.5确实可以解决问题。我可以在API浏览器中看到我的API。我还注意到.api文件在不同版本的App Engine中存在差异,我将把它添加到上面的问题中。似乎最好的解决办法是在1.7.7 SDK发布之前使用1.7.5 SDK,或者手动更改
根目录和适配器.bns
文件中的值。很抱歉给您带来不便。