Cloud Endpoints Frameworks for App Engine command-line tool
Stay organized with collections
Save and categorize content based on your preferences.
This page describes how to use the Endpoints Frameworks command-line
tool 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.
You can generate client library bundles that allow applications to access your
API using the Endpoints Frameworks command-line tool. When you
generate a client library, the Endpoints Frameworks command-line tool
automatically generates a
Discovery document
that describes the surface of your API.
The Endpoints Frameworks command-line tool,endpointscfg.py is
available in the Endpoints Frameworks library. For information on
installing the Endpoints Frameworks library using pip, see
Installing the Endpoints Frameworks library.
Note that the following commands assume you have installed the
Endpoints Frameworks library in a directory called lib. Additionally,
the instructions assume you have created your backend API. See the
Endpoints Frameworks for Python tutorial
for an example of using the Endpoints Frameworks command-line tool on
sample code.
Generating a client library bundle from an API
You can use the Endpoints Frameworks command-line tool to generate the
following types of client bundles:
Maven: This bundle includes a pom.xml file with the
Endpoints Frameworks and Google API Client Library dependencies.
The readme.html file provides detailed information on what you need to add
to your pom.xml file for different types of client
applications and how to build a client library for your API using Maven.
Gradle: This bundle includes a build.gradle file with the
Endpoints Frameworks and Google API Client Library dependencies.
The readme.html file provides detailed information on what you need to add
to your build.gradle file for different types of client applications and
how to build a client library for your API using Gradle.
Default client bundle: This bundle contains all the dependency libraries and
the generated source.jar file, which is the Java library that you use in
your client to call your API. This bundle provides your client with all of
the Google API Client Library capabilities, including OAuth. The
readme.html file lists the .jar files that are required for different
types of client applications and other details for using the client library.
If you are using the client library with an Android app, we recommend that you
use a Gradle client bundle.
Generating the client library
To generate the client library:
Change directory to the directory containing your API's app.yaml
file and API service classes. Alternatively, use the
--application
option to specify some other location of your application directory.
Invoke the Endpoints Frameworks command-line tool similar to the
following:
TARGET_LANG specifies the type of client bundle you
want to create. Currently, you are required to supply the value java (for
Java clients such as Android).
OPTIONS, if supplied, is one or more items shown in the
Options table
CLASS_NAME is the fully qualified class name of your
API.
Options
You can use the following options:
Option name
Description
Example
application
By default, the tool generates from the backend API in the current directory.If you want to generate using a different directory, specify the path to the directory containing the app.yaml and service classes that implement your API.
--application /my_path/my_api_dir
build-system
Lets you specify which type of client bundle should be produced. Specify gradle for a Gradle client bundle for Android, maven for a Maven client bundle, or default (or simply omit this option) for a bundle that contains only the dependency libraries and source jar.
--build-system=gradle-bs gradle
hostname
Specifies the discovery document rootURL.This option overrides the default value derived from the application entry inside the backend API project app.yaml ([YOUR_APP_ID].appspot.com) and the hostname defined in the decorator for your API.One use of this option is to supply the hostname localhost as the rootURL for local testing.
--hostname localhost
format
Don't specify this because the only supported value is the default value, rest for REST.
Not needed, use default.
output
Sets the directory where the output is written to.Default: the directory the tool is invoked from.
--output /mydir-o /mydir
Supported client platforms
The following platforms are supported in the client bundle produced by the
Endpoints Frameworks command-line tool:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe Endpoints Frameworks command-line tool generates client library bundles, including Maven, Gradle, and default, for Java or Android apps to interact with your Python backend API.\u003c/p\u003e\n"],["\u003cp\u003eThis tool automatically creates a Discovery document detailing your API's structure when generating a client library.\u003c/p\u003e\n"],["\u003cp\u003eTo generate a client library, navigate to the directory containing your API's \u003ccode\u003eapp.yaml\u003c/code\u003e and service classes, then use the \u003ccode\u003eendpointscfg.py get_client_lib\u003c/code\u003e command with the target language, options, and API class name.\u003c/p\u003e\n"],["\u003cp\u003eYou can specify options such as \u003ccode\u003e--application\u003c/code\u003e, \u003ccode\u003e--build-system\u003c/code\u003e, \u003ccode\u003e--hostname\u003c/code\u003e, and \u003ccode\u003e--output\u003c/code\u003e to customize the client library generation process.\u003c/p\u003e\n"],["\u003cp\u003eThe command \u003ccode\u003eendpointscfg.py get_openapi_spec\u003c/code\u003e generates an OpenAPI document from your API, and it supports options like \u003ccode\u003e--application\u003c/code\u003e, \u003ccode\u003e--hostname\u003c/code\u003e, and \u003ccode\u003e--output\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Cloud Endpoints Frameworks for App Engine command-line tool\n\nThis page describes how to use the Endpoints Frameworks command-line tool 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.\n\nYou can generate client library bundles that allow applications to access your\nAPI using the Endpoints Frameworks command-line tool. When you\ngenerate a client library, the Endpoints Frameworks command-line tool\nautomatically generates a\n[Discovery document](https://developers.google.com/discovery/v1/reference/apis)\nthat describes the surface of your API.\n\nThe Endpoints Frameworks command-line tool,`endpointscfg.py` is\navailable in the Endpoints Frameworks library. For information on\ninstalling the Endpoints Frameworks library using `pip`, see\n[Installing the Endpoints Frameworks library](/endpoints/docs/frameworks/python/get-started-frameworks-python#installing_the_endpoints_frameworks_library).\nNote that the following commands assume you have installed the\nEndpoints Frameworks library in a directory called `lib`. Additionally,\nthe instructions assume you have created your backend API. See the\n[Endpoints Frameworks for Python tutorial](/endpoints/docs/frameworks/python/get-started-frameworks-python)\nfor an example of using the Endpoints Frameworks command-line tool on\nsample code.\n\n\nGenerating a client library bundle from an API\n----------------------------------------------\n\nYou can use the Endpoints Frameworks command-line tool to generate the\nfollowing types of client bundles:\n\n- Maven: This bundle includes a `pom.xml` file with the\n Endpoints Frameworks and Google API Client Library dependencies.\n The `readme.html` file provides detailed information on what you need to add\n to your `pom.xml` file for different types of client\n applications and how to build a client library for your API using Maven.\n\n- Gradle: This bundle includes a `build.gradle` file with the\n Endpoints Frameworks and Google API Client Library dependencies.\n The `readme.html` file provides detailed information on what you need to add\n to your `build.gradle` file for different types of client applications and\n how to build a client library for your API using Gradle.\n\n- Default client bundle: This bundle contains all the dependency libraries and\n the generated `source.jar` file, which is the Java library that you use in\n your client to call your API. This bundle provides your client with all of\n the Google API Client Library capabilities, including OAuth. The\n `readme.html` file lists the `.jar` files that are required for different\n types of client applications and other details for using the client library.\n\nIf you are using the client library with an Android app, we recommend that you\nuse a Gradle client bundle.\n\n### Generating the client library\n\nTo generate the client library:\n\n1. Change directory to the directory containing your API's `app.yaml`\n file and API service classes. Alternatively, use the\n [`--application`](#options)\n option to specify some other location of your application directory.\n\n2. Invoke the Endpoints Frameworks command-line tool similar to the\n following:\n\n lib/endpoints/endpointscfg.py get_client_lib java -bs gradle main.EchoApi\n\n where `main` is the class containing your API and `EchoApi` is your API name.\n3. Wait for the tool to generate the client library; on success the tool displays a\n message similar to this one:\n\n API client library written to ./echo-v1.zip\n\n4. Add the client library JAR to your Android app.\n\n5. Repeat the preceding steps every time you modify your API code.\n\nThe client library bundle is written to the current directory unless you\nspecify some other output directory using the\n[`output`](#options)\noption.\n\n### Command-line syntax\n\nThe basic syntax is as follows: \n\n```\n/path-to/your-app/lib/endpointscfg.py get_client_lib TARGET_LANG OPTIONS CLASS_NAME\n```\n\nwhere:\n\n- \u003cvar translate=\"no\"\u003eTARGET_LANG\u003c/var\u003e specifies the type of client bundle you want to create. Currently, you are required to supply the value `java` (for Java clients such as Android).\n- \u003cvar translate=\"no\"\u003eOPTIONS\u003c/var\u003e, if supplied, is one or more items shown in the [Options table](#options)\n- \u003cvar translate=\"no\"\u003eCLASS_NAME\u003c/var\u003e is the fully qualified class name of your API.\n\n| **Note:** If your API is implemented from multiple classes, specify each of them separated by a space.\n\n### Options\n\nYou can use the following options:\n\n\n### Supported client platforms\n\nThe following platforms are supported in the client bundle produced by the\nEndpoints Frameworks command-line tool:\n\n- Java 7 and higher:\n- [Android](https://github.com/googleapis/google-api-java-client/wiki/Android) 1.6 and higher.\n- [App Engine](https://github.com/googleapis/google-api-java-client/wiki).\n\nGenerating an OpenAPI document from an API\n------------------------------------------\n\nThe `endpointscfg.py` tool provides a command to generate an OpenAPI document\nfrom an API backend. The command syntax is: \n\n lib/endpoints/endpointscfg.py get_openapi_spec\n [-h]\n [-a APPLICATION]\n [--hostname HOSTNAME]\n [-o OUTPUT]\n service [service ...]\n\n positional arguments:\n service Fully qualified service class name.\n\n optional arguments:\n -h, --help Show this help message and exit.\n -a APPLICATION, --application APPLICATION\n The path to the Python App Engine application.\n --hostname HOSTNAME Default application hostname, if none is specified for the API service.\n -o OUTPUT, --output OUTPUT\n The directory to store output files.\n --x-google-api-name Add the 'x-google-api-name' field to the generated OpenAPI document.\n\nFor example, using [the `echo` example](https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/appengine/standard/endpoints-frameworks-v2/echo): \n\n $ lib/endpoints/endpointscfg.py get_openapi_spec --hostname=echo-example.appspot.com main.EchoApi\n OpenAPI spec written to ./echov1openapi.json"]]