title: How does one send a REST request to an annotated GRPC endpoint?
body: <p>I am not receiving a valid response when <code>curl</code>ing the REST annotated endpoint from the GRPC protobuf</p>
  
  <p>I'm currently running the <a href="https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/endpoints/bookstore-grpc-transcoding/bookstore_server.py" rel="nofollow noreferrer">bookstore server</a> from <a href="https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/endpoints/bookstore-grpc-transcoding" rel="nofollow noreferrer">here</a></p>
  
  <p>I've been able to hit the endpoint successfully via GRPC using the provided client.</p>
  
  <pre class="lang-sh prettyprint-override"><code>$ python bookstore_client.py
  ListShelves: shelves {
    id: 1
    theme: "Fiction"
  }
  shelves {
    id: 2
    theme: "Fantasy"
  }
  </code></pre>
  
  <p>When I try to hit the corresponding REST endpoint, it gives me back a non-text (i.e. not JSON) response</p>
  
  <pre class="lang-sh prettyprint-override"><code>$ curl --raw --http2 localhost:8000/v1/shelves 2&gt;/dev/null | xxd
  00000000: 0000 1804 0000 0000 0000 0400 4000 0000  ............@...
  00000010: 0500 4000 0000 0600 0020 00fe 0300 0000  ..@...... ......
  00000020: 0100 0004 0800 0000 0000 003f 0001 0000  ...........?....
  00000030: 0806 0000 0000 0000 0000 0000 0000 00    ...............
  </code></pre>
  
  <p>I receive this response no matter what the uri is i.e. <code>/v1/foobar</code> gives the same result</p>
  
  <p>Here are the relevant lines from the <a href="https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/endpoints/bookstore-grpc-transcoding/bookstore.proto" rel="nofollow noreferrer">protobuf</a></p>
  
  <pre class="lang-proto prettyprint-override"><code>  rpc ListShelves(google.protobuf.Empty) returns (ListShelvesResponse) {
      // Define HTTP mapping.
      // Client example (Assuming your service is hosted at the given 'DOMAIN_NAME'):
      //   curl http://DOMAIN_NAME/v1/shelves
      option (google.api.http) = { get: "/v1/shelves" };
    }
  </code></pre>
  
  <p>I expected the same response that the python client gave me but I'm receiving a non-text response from the GRPC server.</p>