【发布时间】:2013-08-05 14:38:39
【问题描述】:
我在 Google API 中看到了这一点。 Cloud Endpoints 也可以吗?
https://developers.google.com/apis-explorer/#p/adexchangebuyer/v1.2/adexchangebuyer.accounts.get
【问题讨论】:
标签: google-app-engine google-cloud-endpoints
我在 Google API 中看到了这一点。 Cloud Endpoints 也可以吗?
https://developers.google.com/apis-explorer/#p/adexchangebuyer/v1.2/adexchangebuyer.accounts.get
【问题讨论】:
标签: google-app-engine google-cloud-endpoints
完全有可能。我们有一些关于猴子补丁的 StackOverflow 帖子,这将是另一个很好的例子。
例如:
How do I specify my own icons so they show up in a Google Endpoints API discovery document?
对于这种情况,/_ah/spi/BackendService.getApiConfigs 提供的内容包含您的 API 配置,而您在此处需要的“描述”是“参数”。
例如在方法中
@endpoints.method(MySchema, MySchema,
path='myschema/{strField}', name='myschema.echo')
def MySchemaEcho(self, request):
return request
strField 字段是一个路径“参数”,因此在 API 配置中我们会看到
{
...
"methods": {
"myapi.myschema.echo": {
...
"request": {
...
"parameters": {
"strField": {
"required": true,
"type": "string"
}
}
},
...
}
...
}
}
要在其中获取您的描述,您需要将其添加到strField 下列出的字典中,以便读取
"strField": {
"required": true,
"type": "string",
"description": "Most important field that ever was."
}
【讨论】: