我们受困于Google Cloud Endpoint。根据Google Calendar API Explorer (https://developers.google.com/apis-explorer/#p/calendar/v3/calendar.events.update)的说法,应该可以在Google API explorer中使用java.util.Map,如下所示,用于‘extendedProperties’的'shared‘属性:

但是,当我们使用Map时,它只是在API资源管理器中显示为“empty”,我们不能像在Calendar API中那样向其中添加条目:

以下是该字段的代码:
private java.util.Map<String, String>  impactedCustomersPrivate;
public Map<String, String> getImpactedCustomersPrivate() {
    return impactedCustomersPrivate;
}
public void setImpactedCustomersPrivate(Map<String, String> impactedCustomersPrivate) {
    this.impactedCustomersPrivate = impactedCustomersPrivate;
}类中的所有其他字段,如Strings、Long甚至List,在API Explorer中都可以正常工作。此外,从Javascript客户端调用具有完整Map的方法是可行的,因此真正的问题只是在API explorer中看不到Map。
我一直在研究Calendar API Java Client (https://developers.google.com/api-client-library/java/apis/calendar/v3/java)的源代码,他们使用的是ExtendedProperties的Map,见截图:

使用了注释和扩展GenericJson,但没有任何帮助。
有没有人知道为什么地图没有出现在API浏览器中?不能在本地开发服务器上工作,也不能部署在GAE上。使用常规的POST请求或Javascript客户端库调用该方法,它就能正常工作。
谢谢!
发布于 2016-01-16 06:02:42
事实上,似乎上游云端点的一些内部部分是Google选择不共享的。不过,在此期间,您可能还没有发现仍然可以输入任意的JSON数据,只是没有花哨的UI。
只需将鼠标悬停在有效载荷框中出现的缺口上,然后点击“自由形式编辑器”:
这可以让你输入任何你想要的JSON。在这里,我们希望Google有一天会分享他们在UI中使用的任何代码(以及一种覆盖API浏览器中的小图标的方法)。

https://stackoverflow.com/questions/32050561
复制相似问题