We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
RPC Mock: Free Fake RPC Endpoints
RPC Mock provides free gRPC, JSON-RPC (coming soon) and XML-RPC (coming soon) endpoints for testing and prototyping.
TL;DR
-
1
Download the protobuf file(s). Server reflection is planned but not yet supported.
$ curl -O https://rpcmock.com/v1/protos/user.proto
-
2
Make your first call with gRPCurl.
$ grpcurl -plaintext -proto user.proto \ -d '{"userId": 1}' rpcmock.com:50051 com.rpcmock.v1.UserService.GetUser
Dataset
RPC Mock is still in Alpha so the data returned may change as the service is improved.
Every RPC type on RPC Mock offers endpoints to a shared dataset, with some types supporting additional endpoints too.
- 50 Users → /users.json
- 500 Posts (each user has 10 posts) → /posts.json
- More coming soon...
gRPC Endpoints
RPC Mock provides gRPC endpoints for unary RPC (the simplest type of RPC, a single request receives a single response) as well as endpoints for server-streaming and bidirectional streaming.
gRPCurl: Curl for gRPC
gRPCurl is a command-line tool that lets you interact with gRPC servers. It's basically Curl for gRPC servers and is what we'll be using to make calls to RPC Mock below.
Protobuf files
RPC Mock doesn't yet support server reflection, so before making any calls start by downloading the protobuf files.
$ curl -O https://rpcmock.com/v1/protos.zip
$ unzip protos.zip
User Service
Get a user by ID:
$ grpcurl -plaintext -proto user.proto \
-d '{"userId": 1}' rpcmock.com:50051 com.rpcmock.v1.UserService.GetUser
Get all users:
$ grpcurl -plaintext -proto user.proto rpcmock.com:50051 com.rpcmock.v1.UserService.GetUsers
Stream all users:
$ grpcurl -plaintext -proto user.proto rpcmock.com:50051 com.rpcmock.v1.UserService.StreamUsers
Create a new user:
Note: User will not be created on the server but it will be faked as if it was.
$ grpcurl -plaintext -proto user.proto \
-d '{
"user": {
"name": "Elliot",
"username": "elliotekj",
"website": "https://elliotekj.com"
}
}' rpcmock.com:50051 com.rpcmock.v1.UserService.CreateUser
Update a user:
Note: User will not be updated on the server but it will be faked as if it was.
$ grpcurl -plaintext -proto user.proto \
-d '{
"user": {
"id": 1,
"name": "Elliot",
"username": "elliotekj",
"website": "https://elliotekj.com"
}
}' rpcmock.com:50051 com.rpcmock.v1.UserService.UpdateUser
Post Service
Get a post by ID:
$ grpcurl -plaintext -proto post.proto \
-d '{"postId": 1}' rpcmock.com:50051 com.rpcmock.v1.PostService.GetPost
Get all posts:
$ grpcurl -plaintext -proto post.proto rpcmock.com:50051 com.rpcmock.v1.PostService.GetPosts
Stream all posts:
$ grpcurl -plaintext -proto post.proto rpcmock.com:50051 com.rpcmock.v1.PostService.StreamPosts
Create a new post:
Note: Post will not be created on the server but it will be faked as if it was.
$ grpcurl -plaintext -proto post.proto \
-d '{
"post": {
"userId": 1,
"title": "An introduction to RPC Mock",
"body": "In this post..."
}
}' rpcmock.com:50051 com.rpcmock.v1.PostService.CreatePost
Update a post:
Note: Post will not be updated on the server but it will be faked as if it was.
$ grpcurl -plaintext -proto post.proto \
-d '{
"post": {
"id": 1,
"title": "An updated introduction to RPC Mock"
}
}' rpcmock.com:50051 com.rpcmock.v1.PostService.UpdatePost
Ping-Pong Service
Bidirectional ping-pong streaming:
$ grpcurl -plaintext -proto ping_pong.proto \
-d '{"type": "PING"}{"type": "PING"}' rpcmock.com:50051 com.rpcmock.v1.PingPongService.StreamPingPong
JSON-RPC Endpoints
XML-RPC Endpoints
What is RPC?
At its core, a remote procedure call (RPC) allows programs to cause a procedure to execute in another address space, commonly on another computer on a shared network.
When an RPC is initiated, the calling program sends a request to the remote system, specifying the procedure to be executed and providing the necessary parameters. The remote system receives the request, processes it, executes the specified procedure, and then sends back the results to the calling program. This entire process is usually transparent to the end user, ensuring a seamless integration between local and remote computing resources.
Created by @elliotekj