Generating Discovery Docs for iOS

To call your backend API from an iOS app, you need to generate a discovery document for RPC and supply it to the OS X library generator.

Before you begin

Before you can generate a discovery doc, you must annotate the backend API code. For an example of how to annotate your backend API code, see the backend API tutorial.

Generating a discovery doc for an iOS app

To generate a discovery doc for an Android app:

Maven

To generate the discovery doc using Maven:

  1. Invoke the following command in the directory containing your project pom.xml file:

  2.   mvn appengine:endpoints_get_discovery_doc
    
  3. Note the location of the generated discovery doc. The console will display a message similar to the following:

  4.   API Discovery Document written to
      /[your-path]/[your-projectdir]/target/generated-sources/appengine-endpoints/WEB-INF/helloworld-v1-rpc.discovery
        
  5. Supply the generated discovery doc to the OS X library generator.

Endpoints CLI

To generate the discovery doc using the Endpoints command line tool:

  1. If you haven't already done so, build the backend API.

  2. Change directory to the parent directory of your project's /war directory. Alternatively, use the --war option to specify the location of war.

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

    appengine-sdk/bin/endpoints.sh get-discovery-doc --format=rpc \
        com.google.devrel.samples.ttt.spi.BoardV1
    

    where the format is set explicitly to rpc (since the commmand line tool default is REST), and where you replace com.google.devrel.samples.ttt.spi.BoardV1 with your own API class. (If your API is implemented across several classes, list each class separated by a space.)

  4. When successful, the tool displays a message similar to:

    INFO: Successfully processed ./war/WEB-INF/appengine-web.xml
    API Discovery Document written to ./tictactoe-v1-rest.discovery
    

    The discovery document is written to the current directory unless you specify some other output directory using the --output option.

  5. Supply the generated discovery doc to the OS X library generator.

Google discovery documents

A Google discovery document describes the surface for a particular version of an API. The information provided by the discovery document includes API-level properties such as an API description, resource schemas, authentication scopes, and methods.

What's next?