Requests API


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.

API Blueprint

Messages

Group of all messages-related resources.

My Message

Retrieve a Message

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.

REQUEST Plain Text Message

Headers
Accept text/plain

RESPONSE

Headers
Content-Type text/plain
X-My-Message-Header 42
200 text/plain
                        Hello World!

                      
                        
                      

REQUEST JSON Message

Headers
Accept application/json

RESPONSE

Headers
Content-Type application/json
X-My-Message-Header 42
200 application/json
                        { "message": "Hello World!" }

                      
                        
                      

Update a Message

REQUEST Update Plain Text Message

Headers
Content-Type text/plain
text/plain
                          All your base are belong to us.

                        
                          
                        

RESPONSE

Headers

REQUEST Update JSON Message

Headers
Content-Type application/json
application/json
                          { "message": "All your base are belong to us." }

                        
                          
                        

RESPONSE

Headers