FORMAT: X-1A
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 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!" }
-
-
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