Let’s see an example, of how Leopold Bloom could interact with a digital store nowadays to order a book.
- Search according to a keyword on the online store
- Filter only by schema.org/Book objects
- Pick an object from the list
- Pick the postage method
- Pick the posting address
- Proceed to checkout
- Provide payment options
- Wait to verify the transaction
- Retrieve the receipt
Requests 1 and 2 could be combined by sending the search get request only for books.
It is quite easy to recognize the resources involved in this transaction.
- Resources:
- Book
- List of Books
- Address
- Postage
- Order
- Receipt
The affordances taking are listed also below: Affordances:
- Search on store
- Add to Basket
- Filter by
- Pick an object
- Select address
- Provide payment options
- Waiting until request finalizes
- Retrieving the receipt
The search could be modelled according to SearchAction
application/ld+json
{
“@context”: “http://schema.org”,
“@type”: “SearchAction”,
“agent”: {
“@type”: “Person”,
“name”: “Leopold”
},
“query”: “Bring all the books named Ulysses.”
}
The API is described according to the Hydra Specification regarding the Hypermedia structure of it.
At the end of it, there is the Finite State Machine, in a SWRL format. This is recognised by ‘fsm’ tag. So, an agent will recognise this by finding the
{
“fsm”: {
#Rules
}
}
The code for this can be found on this github repository.