Testing POST Request with protobuf --> send binary payload

3,261 views
Skip to first unread message

zera...@freenet.de

unread,
Jun 26, 2018, 12:22:25 PM6/26/18
to Protocol Buffers
Hello,

I already implemented with spring boots REST services, whichs allows me to GET the encoded payload in x-protobuf with the CURL command:

curl -X GET --header "Accept: application/x-protobuf" "[...URL...]" | protoc --decode_raw


I'll see the correct result in plaintext. The generated *.java class based on my *.proto seems to work fine. 


Now I'm struggling on a really simple point: I'm not able to send my binary protobuf stream via CURL to my POST-service. I have a simple message file with human-readable JSON content (--> UploadLogs.payload) and my protofile. Based on this, I want to generate the the binary protobuf payload and want to POST-call the REST service. Do you have an idea, how I can handle this? :)



Something like...


curl -X POST --data-binary @UploadLogs.payload --header "Accept: application/x-protobuf" "[...URL...]"


Maybe, I have to save the binary protobuf content with protoc --encode first in a separate file, and then call CURL with this new filename with the --data-binary parameter. Right now, I'm not able to store the protobuf payload based on the JSON file in a new separate file. 


Any help would be really appreciated! :)


Kind regards

Emily


Adam Cozzette

unread,
Jun 27, 2018, 12:44:03 PM6/27/18
to zera...@freenet.de, Protocol Buffers
This seems like it should be doable. Is there some reason you can't store the payload in binary format in a separate file?

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages