Resource Model API


Resource model is a resource manifestation. One particular representation of your resource.

Furthermore, in API Blueprint, any resource model you have defined can be referenced in a request or response section, saving you lots of time maintaining your API blueprint. You simply define a resource model as any payload (e.g. request or response) and then reference it later where you would normally write a request or response.

API Blueprint

Messages

Group of all messages-related resources.

My Message

Retrieve a Message

At this point we will utilize our Message resource model and reference it in Response 200.

REQUEST

RESPONSE

This is the application/vnd.siren+json message resource representation.

Headers
Content-Type application/vnd.siren+json
Location http://api.acme.com/message
200 application/vnd.siren+json
                      {
  "class": [
    "message"
  ],
  "properties": {
    "message": "Hello World!"
  },
  "links": [
    {
      "rel": "self",
      "href": "/message"
    }
  ]
}
                    
                      
                    

Update a Message

REQUEST Update Plain Text Message

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

                      
                        
                      

RESPONSE

REQUEST Update JSON Message

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

RESPONSE