How to form protobuf resource part of http request body and test it through dhc client or postman for restful services

Rajiv picture Rajiv · Sep 4, 2016 · Viewed 14.6k times · Source

I have created a .proto message and I'm exposing a rest service which looks like this

@Path("/test")
public interface test{

@POST
@Produces("application/x-protobuf")
@Consumes("application/x-protobuf")
public Response getProperties(TestRequest testrq);
}

Now TestRequest being the Java generated file of .protobuf how do i pass it in request body ?

this will be be the .proto file format

message TestRequest
{
    string id = 1;
    string name = 2;
    enum TestType
    {
        Test=1
    }
   TestType testType = 3; 
}

Answer

spluxx picture spluxx · Mar 1, 2020

Give Protoman a try if you need a simple protobuf api client.

Disclaimer: It's my side project