Outil de ligne de commande Cloud Endpoints Frameworks pour App Engine
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Cette page explique comment générer une bibliothèque cliente à partir de l'API de votre serveur backend à l'aide de l'outil de ligne de commande Endpoints Frameworks. N'importe quelle application Java ou Android peut utiliser cette bibliothèque pour appeler l'API.
Vous pouvez générer des groupes de bibliothèques clientes permettant aux applications d'accéder à votre API à l'aide de l'outil de ligne de commande Endpoints Frameworks. Lorsque vous générez une bibliothèque cliente, l'outil de ligne de commande Endpoints Frameworks génère automatiquement un document de découverte décrivant la surface de votre API.
Pour obtenir l'outil de ligne de commande Endpoints Frameworks, téléchargez endpoints-framework-tools à partir du dépôt central Maven.
Une fois que vous aurez extrait le contenu du fichier ZIP, vous trouverez l'outil dans le répertoire endpoints-framework-tools-2.2.1/bin/.
Générer un groupe de bibliothèques clientes à partir d'une API
Vous pouvez utiliser l'outil de ligne de commande Endpoints Frameworks pour générer les types de groupes de clients suivants :
Maven : ce groupe comprend un fichier pom.xml avec les dépendances d'Endpoints Frameworks et de la bibliothèque cliente des API Google.
Le fichier readme.html fournit des informations détaillées sur ce que vous devez ajouter à votre fichier pom.xml pour différents types d'applications clientes et explique comment créer une bibliothèque cliente pour votre API à l'aide de Maven.
Gradle : ce groupe comprend un fichier build.gradle avec les dépendances d'Endpoints Frameworks et de la bibliothèque cliente des API Google.
Le fichier readme.html fournit des informations détaillées sur ce que vous devez ajouter à votre fichier build.gradle pour différents types d'applications clientes et explique comment créer une bibliothèque cliente pour votre API à l'aide de Gradle.
Groupe de clients par défaut : ce groupe contient toutes les bibliothèques de dépendances. Il comporte également le fichier source.jar généré, qui est la bibliothèque Java que vous utilisez dans votre client pour appeler votre API. Ce groupe fournit à votre client toutes les fonctionnalités de la bibliothèque cliente des API Google, y compris OAuth. Le fichier readme.html répertorie les fichiers .jar requis pour différents types d'applications clientes, ainsi que d'autres informations concernant l'utilisation de la bibliothèque cliente.
Si vous utilisez la bibliothèque cliente avec une application Android, nous vous recommandons d'opter pour un groupe de clients Gradle.
Syntaxe de la ligne de commande
Avant d'utiliser l'outil de ligne de commande Endpoints Frameworks, vous devez créer votre projet backend, car cet outil nécessite des fichiers binaires compilés. Vous pouvez éventuellement fournir l'option --war= pointant vers le répertoire de création cible qui contient le répertoire WEB-INF et les classes Java compilées, si vous ne souhaitez pas utiliser la valeur par défaut (--war="./war").
où target/echo-1.0-SNAPSHOT est le chemin relatif ou absolu du répertoire de création cible contenant WEB-INF et les classes backend compilées.
Options
Vous pouvez utiliser les options suivantes :
Nom de l'option
Description
Exemple
build-system
Permet de spécifier le type de groupe de clients à produire. Spécifiez gradle pour un groupe de clients Gradle pour Android, maven pour un groupe de clients Maven, ou default (ou omettez simplement cette option) pour un groupe ne contenant que les bibliothèques de dépendances et le fichier JAR source.
--build-system=gradle -bs gradle
war
Définit le chemin d'accès au répertoire de création cible WEB-INF contenant le fichier appengine-web.xml et d'autres métadonnées. Par défaut : ./war.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[[["\u003cp\u003eThe Endpoints Frameworks command-line tool generates client library bundles, enabling Java or Android apps to access backend server APIs.\u003c/p\u003e\n"],["\u003cp\u003eThis tool automatically generates a Discovery document that outlines the API's structure, which is crucial for client interactions.\u003c/p\u003e\n"],["\u003cp\u003eClient library bundles can be generated in Maven, Gradle, or default formats, with each format catering to different project setups and providing necessary dependencies and build instructions.\u003c/p\u003e\n"],["\u003cp\u003eThe command-line tool requires compiled backend project binaries and allows options for specifying the build system, war directory, and output location, making customization easy.\u003c/p\u003e\n"],["\u003cp\u003eThe generated client libraries are compatible with Java 7+, Android 1.6+, and App Engine, ensuring wide applicability.\u003c/p\u003e\n"]]],[],null,["# Cloud Endpoints Frameworks for App Engine command-line tool\n\nThis page describes how to generate a client library from your backend server API by using the Endpoints Frameworks command-line tool. 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\nTo get the Endpoints Frameworks command-line tool, download\n[`endpoints-framework-tools`](http://search.maven.org/remotecontent?filepath=com/google/endpoints/endpoints-framework-tools/2.2.1/endpoints-framework-tools-2.2.1.zip)\nfrom the [Maven Central Repository](http://search.maven.org/).\nAfter you extract the contents of the zip file, the tool is in the\n`endpoints-framework-tools-2.2.1/bin/` directory.\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### Command-line syntax\n\nBefore you use the Endpoints Frameworks command-line tool, you must\nbuild your backend project because this tool requires compiled binaries. You can\noptionally supply the `--war=` option pointing to the build target output\ndirectory containing the `WEB-INF` directory and compiled java classes if you\ndon't want to use the default (`--war=\"./war\"`).\n\nThe basic syntax is as follows: \n\n```\n/path-to/endpoints-framework-tools-2.2.1/bin/endpoints-framework-tools \\\n get-client-lib OPTIONS CLASS_NAME\n```\n\nwhere:\n\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\nFor example: \n\n /path-to/endpoints-framework-tools-2.2.1/bin/endpoints-framework-tools \\\n get-client-lib --war=target/echo-1.0-SNAPSHOT -bs gradle com.example.echo.Echo\n\nwhere `target/echo-1.0-SNAPSHOT` is the relative or absolute path to the\ntarget build directory containing `WEB-INF` and the compiled backend classes.\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)."]]