Search code examples
javagoogle-app-enginegoogle-cloud-endpoints

How to pass custom object to app engine endpoint


I'm using Google App Engine Endpoints. Docs says that only primitive types like String, int and so on are supported. I want to pass an object. I read about the @ApiTransform annotation so I thought to use to convert my object from/to String object, but I'm not sure about the "scope" of this kind of annotation. Is it the right goal? Or the transform api is designed for another goal? I didn't find any example or code about a real use of this annotation.


Solution

  • here you can find example code for @ApiTransform

    https://github.com/GoogleCloudPlatform/appengine-endpoints-helloworld-java-maven/tree/master/src/main/java/com/example/helloworld

    and some more documentation here

    https://cloud.google.com/endpoints/docs/frameworks/legacy/v1/java/annotations

    You can only return custom objects from Endpoints but not passing objects to the endpoint.

    @ApiTransform can only be used for changing the object which will be returned from your endpoint.