Re: Non-trivial trading flows with schema.org

Hi Dietrich,


> I have started to implement a "restbucks" coffee shop with hydra, hoping I
> could use schema.org.
>
> The results are not so encouraging so far, especially when it comes to
> interactions. On https://lists.w3.org/Archives/
> Public/public-vocabs/2015Feb/0092.html I have asked how it should work
> with schema:potentialActions, but I have similar problems with
> hydra:Operation. The necessary properties are simply not there, where I
> could attach my operations.
>
> I'm no expert, but it looks like the schema.org example you have is doing
a different thing to a REST API. The link above is more like data modelling
of what is on offer, whereas REST (Representational *State Transfer*)
should model the current state and how to change it.

I guess it's like the difference between modelling the options on the menu
(the data about what's available) versus the process you go through to buy
a coffee (e.g. modelling the state of the order as it gets updated when you
answer questions from the barista).

If you imagine being at the coffee counter. The first state might be coffee
choices, so your API would return something like:

CoffeeChoice:
  Link: Choose Americano
  Link: Choose Latte

Clicking a link would update the order state and take you to the next list
of options to further change the state, e.g:

OrderOffers:
  Link: Add an extra shot for 0.20 Euros
  Link: No thanks, go straight to checkout

The workflow is created by supplying the user with information about the
current order state and any possible state transitions based on it's
current state (rather than modelling all the state changes in one document
and expecting the client to sort it out).

Have you read Mike Amundsen's 'RESTful Web APIs' book [1]? It helped me
clarify my REST thinking, particularly around modelling state transitions.
Apologies if you know this all already and I'm misinterpreting.

Cheers,

Kev

[1] http://shop.oreilly.com/product/0636920028468.do

-- 
www.dataunity.org
twitter: @data_unity

Received on Friday, 20 February 2015 10:40:44 UTC