gRPC is a high-performance, efficient Remote Procedure Call (RPC) framework widely adopted in modern distributed systems. In microservices architectures, gRPC facilitates efficient inter-service communication with low latency and reduced bandwidth consumption through its streaming capabilities and Protocol Buffers serialization.The gRPC API debugging functionality is currently in Beta testing. Requires Apidog version 2.3.1 or later.
Prerequisites#
Before using gRPC in Apidog, ensure you have:Apidog version 2.3.1 or later
.proto files defining your gRPC services and methods
Access to a gRPC server endpoint
Creating a gRPC Project#
To create a new gRPC project:1.
Click "New Project" on the Apidog homepage
2.
Select "gRPC Project (Beta)"
Importing Proto Files#
gRPC follows an API-First approach, requiring services, methods, and messages to be defined through .proto files before development. Import your .proto file to begin debugging gRPC APIs in Apidog.Initial Import#
Apidog supports three import methods:| Method | Description |
|---|
| Local File | Upload a .proto file from your local filesystem |
| URL | Import from a URL hosting the .proto file |
| Server Reflection | Automatically discover services from a gRPC server |
The selected .proto file imports as one Proto, where:Services are imported as services
RPC methods are imported as methods
Dependencies must be manually added if the .proto file depends on other files
Related services from dependent .proto files with the same package are also imported
Reimporting Proto Files#
When your .proto file changes, update it in Apidog:1.
Right-click on the Proto in the directory tree
Invocation Methods#
gRPC supports four method types when defining APIs in .proto files. Apidog supports all four:| Method Type | Description |
|---|
| Unary | Single request, single response (similar to HTTP) |
| Server Streaming | Single request, multiple responses from server |
| Client Streaming | Multiple requests from client, single response |
| Bidirectional Streaming | Multiple requests and responses in both directions |
Unary Calls#
Unary calls function similarly to HTTP requests:1.
Enter the server URL in the address bar
2.
Input message content in JSON format under the Message tab
3.
Click "Invoke" to initiate the call
You can also configure Metadata and Auth information for authentication or complex scenarios.Streaming Calls#
Streaming calls operate similarly to WebSocket connections. After initiating the call, you can write and send messages under the Message tab.Apidog provides a timeline view that displays:Received messages (in chronological order)
Click any message to view its details.Advanced Features#
Auto-Generate Dynamic Values#
Apidog recognizes .proto file content, enabling automatic message body generation:1.
Click the "Auto-generate" button to create the message structure
2.
Use the "Dynamic Values" feature for flexible, dynamic data generation
Using Variables#
Apidog variables can be used in gRPC messages and Metadata for dynamic data injection.Enabling TLS#
gRPC APIs support secure connections through TLS (Transport Layer Security).Click the protocol selector before the URL to toggle TLS status
Use grpcs:// in the URL to enable TLS
Use grpc:// to disable TLS
Managing Server Addresses and Environments#
Adding Server Addresses#
Click the plus icon on the right side of the URL address bar to add the current server address to an environment.Using Environment Server Addresses#
1.
Select the environment and server address in the upper right corner
2.
Choose "Follow Default" in the URL address bar to use a unified server address for debugging all methods
Viewing Proto Files and API Parameters#
Proto File Content#
Click on the Proto in the left directory tree to view the raw content of the .proto file.Request and Response Parameters#
gRPC uses Protocol Buffers (ProtoBuf) as the serialization format. Unlike text-based formats (JSON, XML), ProtoBuf is a binary format not suitable for human reading or writing.In Apidog, all gRPC messages are written and displayed in JSON format for ease of use. You can view request and response parameters in JSON format on the API information page.ProtoBuf to JSON Type Mapping#
| ProtoBuf 3 | JSON | JSON Example |
|---|
| message | object | {"fooBar": v, "g": null, β¦} |
| enum | string | "FOO_BAR" |
| map<K,V> | object | {"k": v, β¦} |
| repeated V | array | [v, β¦] |
| bool | boolean | true, false |
| string | string | "Hello World!" |
| bytes | base64 string | "YWJjMTIzIT8kKiYoKSctPUB+" |
| int32, fixed32, uint32 | number | 1, -10, 0 |
| int64, fixed64, uint64 | string | "1", "-10" |
| float, double | number | 1.1, -10.0, 0, "NaN", "Infinity" |
After completing debugging, click the "Save" button to save:This enables team members to reuse your debugging setup.