Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does REST supports protocol buffers

This might be a very generic question, but considering the fact that REST is focused on accessing named resources through a single consistent interface; does it supports protocol buffers?

like image 394
iHS Avatar asked Feb 10 '16 04:02

iHS


People also ask

What protocols does REST support?

When a request for data is sent to a REST API, it's usually done through hypertext transfer protocol (commonly referred to as HTTP). Once a request is received, APIs designed for REST (called RESTful APIs or RESTful web services) can return messages in a variety of formats: HTML, XML, plain text, and JSON.

Is REST a protocol or not?

REST is a set of architectural constraints, not a protocol or a standard. API developers can implement REST in a variety of ways. When a client request is made via a RESTful API, it transfers a representation of the state of the resource to the requester or endpoint.

What is protocol buffer API?

To simplify developer experience and improve runtime efficiency, gRPC APIs should use Protocol Buffers version 3 (proto3) for API definition. Protocol Buffers is a simple language-neutral and platform-neutral Interface Definition Language (IDL) for defining data structure schemas and programming interfaces.


1 Answers

Yes, you can absolutely combine Protobuf and REST.

Protbuf specifies a way to encode data. REST specifies a way to interact with resources, but does not require any particular encoding for the resource bodies. If you create a RESTful HTTP-based API and use Protobuf to encode the entity-bodies (the technical term for the payload part of an HTTP request or response), then you are using both REST and Protobuf.

like image 145
Kenton Varda Avatar answered Dec 09 '22 17:12

Kenton Varda