The Cloud Endpoints API comes packaged with to generate client libraries in JavaScript, Objective-C (for iOS) and Java (for Android). You can also generate a few additional client libraries using the Google APIs client generator. This article will show you how to use the generator to create a C# client library.

The client generator is a Python application you can install with pip.

pip install google-apis-client-generator

The client generator works by taking an API discovery document, parsing it into an object model, and then using a language template to transform the object model to running code.

To run the generator you will need the discovery document for your API. You can find this document from the root API discovery URL. First, download the root API discovery document using httpie.

http --download
"items": [
        "description": "Example Api",
        "discoveryLink": "./apis/example/v1/rest",
        "discoveryRestUrl": "",
        "icons": {
            "x16": "",
            "x32": ""
        "id": "example:v1",
        "kind": "discovery#directoryItem",
        "name": "example",
        "preferred": true,
        "version": "v1"

The root discovery document will have an items member listing the available APIs and a discoveryLink for each API. The discoveryLink provides the schema for the API. We can download this schema and use it as input to the client generator.

http --download

generate_library --input=rest.json --language=csharp --output_dir=tmp/csharp

Your C# client library is now ready to use. As of this writing you can generate client libraries in C++, C#, Dart, GWT, Java, PHP and Python.