4
votes

We're stuck with Google Cloud Endpoints. According to the Google Calendar API explorer (https://developers.google.com/apis-explorer/#p/calendar/v3/calendar.events.update), it should be possible to use java.util.Map in the Google API Explorer, as can seen below for the 'shared' property of the 'extendedProperties':

enter image description here

However, when we use a Map, it's just showing up as 'empty' in the API explorer, and we can't add entries to it like we can in the Calendar API:

enter image description here

This is the code for that field:

private java.util.Map<String, String>  impactedCustomersPrivate;

public Map<String, String> getImpactedCustomersPrivate() {
    return impactedCustomersPrivate;
}

public void setImpactedCustomersPrivate(Map<String, String> impactedCustomersPrivate) {
    this.impactedCustomersPrivate = impactedCustomersPrivate;
}

All other fields on the class, like Strings, Longs and even List are working as expected in the API Explorer. Furthermore, calling the method with the full Map from the Javascript client works, so the problem really is only that the Map is not visible from the API explorer.

I've been looking into the source code from the Calendar API Java Client (https://developers.google.com/api-client-library/java/apis/calendar/v3/java) and they use a Map for ExtendedProperties, see screenshot:

enter image description here

Played around with the annotations and extending GenericJson, but nothing helps.

Does anyone have a clue why the Map is not showing up in the API explorer? Doesn't work local dev server, nor deployed on GAE.. Calling the method with a regular POST request, or the Javascript Client Library, it works.

Thanks!

1
I think the issue here is that the way Calendar defines their map, it only allows string values, which API explorer supports. Endpoints allows arbitrary types for values, which API explorer doesn't support, which is unfortunate. - saiyr
Hi saiyr, as you can see from my sample, I'm also only using a map of Strings. - Pega88
I'd suggest filing a bug on the App Engine issue tracker, though I can't guarantee this will be fixed soon. - saiyr

1 Answers

0
votes

Indeed it seems like there are internal parts of Cloud Endpoints upstream that Google chooses not to share. In the meantime, though, you may/may not have discovered that you can still enter arbitrary JSON data, just without the fancy UI.

Just hover over the notch that appears when you're in the payload box, and hit "Freeform editor":

This lets you enter any JSON you damn well please. Here's to hoping that Google shares whatever code they are using for their UI someday (along with a way to override the little icons in the API explorer). enter image description here