Following the Responses example, this API will show you how to define multiple requests and what data these requests can bear. Let's demonstrate multiple requests on a trivial example of content negotiation.
Group of all messages-related resources.
In API Blueprint, requests can hold exactly the same kind of information and
can be described using exactly the same structure as responses, only with
different signature – using the Request
keyword. The string that follows
after the Request
keyword is a request identifier. Again, using explanatory
and simple naming is the best way to go.
Headers | |
---|---|
Accept | text/plain |
Headers | |
---|---|
Content-Type | text/plain |
X-My-Message-Header | 42 |
text/plain
Hello World!
Headers | |
---|---|
Accept | application/json |
Headers | |
---|---|
Content-Type | application/json |
X-My-Message-Header | 42 |
application/json
{
"message": "Hello World!"
}