Skip to content

Latest commit

 

History

History
61 lines (34 loc) · 1.56 KB

6. Requests.md

File metadata and controls

61 lines (34 loc) · 1.56 KB

FORMAT: X-1A

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

Group Messages

Group of all messages-related resources.

My Message [/message]

Retrieve a Message [GET]

In API Blueprint requests can hold exactly the same kind of information and can be described by 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 an explanatory and simple naming is the best way to go.

  • Request Plain Text Message

    • Headers

        Accept: text/plain
      
  • Response 200 (text/plain)

    • Headers

        X-My-Message-Header: 42
      
    • Body

        Hello World!
      
  • Request JSON Message

    • Headers

        Accept: application/json
      
  • Response 200 (application/json)

    • Headers

        X-My-Message-Header: 42
      
    • Body

        { "message": "Hello World!" }      
      

Update a Message [PUT]

  • Request Update Plain Text Message (text/plain)

      All your base are belong to us.
    
  • Request Update JSON Message (application/json)

      { "message": "All your base are belong to us." }
    
  • Response 204