【发布时间】:2017-06-11 02:16:37
【问题描述】:
我正在尝试使用此处记录的一组不同的方法为 2 个不同的 api 提供服务:https://cloud.google.com/endpoints/docs/deploying-apis-subdomains
通过 GCE,在我的 main.py 中的结构如下所示
@endpoints.api(name = 'first', version = 'v1')
class firstApi(remote.Service):
@endpoints.method(
# Lots of stuff here
path = 'first'
# Lots more here
@endpoints.api(name = 'second', version = 'v1')
class secondApi(remote.Service):
@endpoints.method(
# Lots of stuff here
path = 'second'
# Lots more here
api = endpoints.api_server([firstApi, secondApi])
但是当我生成 firstv1openapi.json 和 secondv1openapi.json 并部署它们时,会发生一些奇怪的事情。当我在 Google 的 API 资源管理器中加载它时,我在 both API 下看到 both 方法
更糟糕的是,当我点击第二个 API 并通过 API 资源管理器尝试任何方法时,路径总是引用第一个 API。
POST https://my_backend_here.appspot.com/_ah/api/first/v1/second
正如预期的那样失败并出现 404。
我查看了 firstv1openapi.json 和 secondv1openapi.json 以查看 api 是否完全相互交叉引用,它们看起来都很好。
我没有尝试不同的选择,任何帮助将不胜感激。
【问题讨论】:
标签: google-app-engine google-cloud-platform google-cloud-endpoints