gRPC JSON transcoding
Our gRPC mock servers support protocol transcoding so that you can access your gRPC mock API by using REST+JSON. gRPC/gRPC-web protocols can still be used to call your services.
How it works
Every gRPC mock method has corresponding REST method which is constructed using the template below:
HTTP Method and Url
method are taken from your
Please find the
Endpoint URL builder on your mock.qa dashboard which helps you to build a correct URL for your mock
Mapping from gRPC request/response to REST JSON request/response and vice-versa provided by protobuf canonical encoding in JSON implemented by Google Protocol Buffers library.
HTTP Request status
status message fields are included to response as HTTP headers:
How to send REST request to gRPC mock server
Here is the checklist to make a REST+JSON request to gRPC mock
- HTTP method is
- URL matches the URL template above
- Content-Type header is set to
- Request body is a valid JSON (or empty)
Client streaming and duplex streaming are not supported with REST+JSON transcoding. An attempt to make a REST request to such methods will lead to HTTP
408-RequestTimeout error (gRPC status
google.api annotations are not supported yet. Planned for future releases.
To see transcoding in action, try mock.qa gRPC playground, which is built on transcoding feature.