tree: 32468923f601e780d83d58057bfde6d5f022987f [path history] [tgz]
  1. api_proto/
  2. test/
  3. __init__.py
  4. api_service.py
  5. issues_servicer.py
  6. monorail_servicer.py
  7. monorailcontext.py
  8. projects_servicer.py
  9. README.md
  10. users_servicer.py
appengine/monorail/api/README.md

Monorail API v2

This directory holds all the source for the Monorail API v2. This API is implemented using .proto files to describe a gRPC interface (services, methods, and request/response messages). It then uses a shim which converts the gRPC server (which doesn't work on AppEngine, due to lack of support for HTTP/2) into a pRPC server which supports communication over HTTP/1.1, as well as text and JSON IO.

Regenerating Python from Protocol Buffers

In order to regenerate the python server and client stubs from the .proto files, follow these steps:

$ PATH=../../../luci/appengine/components/tools:$PATH ../../../cipd/protoc \
  --python_out=. --prpc-python_out=. api_proto/*.proto

Manually Exercising the API

You can make anonymous requests to a server running locally like this:

$ curl -i -X POST localhost:8080/prpc/monorail.Users/GetUser \
  -H "Content-Type: application/json" -H "Accept: application/json" \
  --data '{"email": "test@example.com"}'