Generating a Client Library

This page describes how to generate a client library from your Python backend API (the code that runs on the server). 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 Using Endpoints in a JavaScript Client.

Before you begin

Generating the client library

The following instructions demonstrate how to use the frameworks command-line tool to generate a Gradle client bundle from the sample code from Getting Started with Cloud Endpoints.

To generate a client library:

  1. Change directory to the directory containing your API app.yaml file and API classes.

  2. Invoke the Endpoints command line tool similar to the following:

    python lib/endpoints/ get_client_lib java -bs gradle main.EchoApi

    where main is the class containing your API and EchoApi is your API name.

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

    API client library written to ./
  4. Unzip the file using the unzip utility, or use another ZIP-compatible unarchiving utility:

    unzip ./
  5. Change directory: cd echo

  6. Build the client library: gradle build

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

  7. Add the client library JAR to your app.

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

Accessing backend APIs from Python clients

For information and sample code showing how to access a backend API from a Python client, see Accessing Backend APIs from Python Clients.

Send feedback about...

Cloud Endpoints Frameworks for App Engine