4

We want to use API blueprint together with a schema. Let's say, we want to specify that PUT to a resource accepts an Account in the payload and GET on the same resource returns an Account payload. So I need to specify that Account is used in GET and PUT and I need to specify the Account itself. I do not know where to specify it, what's the canonical way? Unfortunately I was not able to find it in the examples.

Almad
  • 5,753
  • 7
  • 35
  • 53

1 Answers1

4

Reusing one message payload in multiple action is where can utilize the concept of a resource model.

Simply define a account model and then reuse it later like so:

# Account [/account]

+ Model (application/json)
    + Body

            { ... }

    + Schema

            { ... }

## Retrieve an Account [GET]

+ Response 200

    [Account][]


## Update an Account [PUT]

+ Request

    [Account][]

+ Response 204
hellboy
  • 1,567
  • 6
  • 21
  • 54
Zdenek
  • 3,653
  • 27
  • 34