Reputation: 2429
I can make String, Date and Long work. If I use byte[] I get an error when I run the endpoints.sh script. I can find nothing in the documentation that lists the types supported and the errors generated a pretty cryptic. I'd like to get a little bit of binary (image) data into an endpoint method. This is no good:
@ApiMethod(name = "device.bikeImage.set")
public void setDeviceBikeImage(com.google.appengine.api.users.User appEngineUser,
@Named("facebookAccessToken") @Nullable String facebookAccessToken,
@Named("deviceId") String deviceId, @Named("bikeImage") byte[] bikeImage)
throws IOException, OAuthRequestException {
}
What types are supported?
Upvotes: 2
Views: 1526
Reputation: 2322
The datatypes supported are described in the docs for endpoints, right here.
The supported parameter types are the following:
java.lang.String java.lang.Boolean and boolean
java.lang.Integer and int
java.lang.Long and long java.lang.Float and float
java.lang.Double and double
java.util.Date
com.google.api.server.spi.types.DateAndTime
com.google.api.server.spi.types.SimpleDate
Any enum
Any array or java.util.Collection of a parameter type
Upvotes: 2
Reputation: 133
The following article has a list of the value types that are supported (go to the "Properties and Value Types" section:
https://developers.google.com/appengine/docs/java/datastore/entities
When working with Endpoints, you are definitely limited to only those types that can be serialized into JSON.
There is also minimal discussion on serving blobs from Endpoints in these two questions:
Upvotes: 0