Generating a Client Library

This page describes how to generate a client library from your backend API. Any Java or Android app can use this library to call the API.

To create iOS clients for your API, we recommend that you use Google APIs Objective-C Client Library for REST APIs.

For JavaScript apps, see Calling Endpoints from a JavaScript App.

Before you begin

Generating the client library

The following instructions demonstrate how to use the frameworks Apache Maven and Gradle plugins to generate a Gradle client bundle from the sample Maven project Getting Started with Cloud Endpoints.

To generate a client library:

  1. Build your API

  2. Invoke the frameworks command line tool similarly to the following:

    Maven

    mvn endpoints-framework:clientLibs

    Gradle

    gradle endpointsClientLibs

  3. Wait for the tool to generate the library; on success the tool displays a message similar to this one:

    Maven

    API client library written to target/client-libs/echo-v1-java.zip

    Gradle

    API client library written to build/endpointsClientLibs/echo-v1-java.zip

  4. Unzip the file using the unzip utility, or use another ZIP-compatible unarchiving utility:

    unzip ./echo-v1-java.zip
    
  5. Change directory: cd echo

  6. Build the client library:

    Maven

    mvn clean package

    The output is in the target/ directory. The exact filename depends on the version of the Java client. It will be something similar to echo-v1-1.23.0-SNAPSHOT.jar.

    Gradle

    gradle build

    The output is in the build/libs directory. The exact filename depends on the version of the Java client. It will be something like echo-v1-1.23.0-SNAPSHOT.jar.

  7. Add the client library JAR to your Java or Android app.

  8. Repeat the above steps every time you modify your API code.

What's Next?

Was this page helpful? Let us know how we did:

Send feedback about...

Cloud Endpoints Frameworks for App Engine