我怀疑这是由端点中的以下错误引起的(如果有效),但我也确定某处有解决方法。
重现的步骤:
对上述内容感到沮丧,我决定从头开始全新的应用ID。我仍然在API资源管理器中看不到API,并在上面的第7步中获取了网址上的404!
这是我的端点类:
@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"
}
}
}
}
}
此网址为我提供了404我期望看到我的API JSON:
https://eliot-dev-uk-ditto-do.appspot.com/_ah/api/discovery/v1/apis/ditto/v1
这是在杀我!
编辑:
这是我在App Engine 1.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"
}
...
答案 0 :(得分:2)
正如您已经指出的那样,这是由于SDK 1.7.6中的一个奇怪的问题,它在.api文件中的端点根URL的开头添加了1.
...
我尝试了新的 SDK 1.7.7 ,似乎已经解决了......