On building web service clients for specific tasks

Hello Hydra community!

Great work. I'm very intrigued with all the efforts to drive APIs
through semantics and hypermedia. I'm trying to grasp these concepts
coding a simple client to consume a JSON-LD + Hydra web service. This
client would do a simple task, but instead of hard coding the URL to a
specific end point I'm exploring ways of embedding a notion of
resources and transitions between them.

Suppose I want to do a really simple task with a theoretical CLI that
consumes the issue tracker API: ask a name and search for it in the
User collection. Also assume that the API offers this possibility.

The most straightforward series of steps could be:

1) Request JSON-LD from the entry point
2) Parse the result and expand it
3) Get the value (an URL) of the key
"http://www.markus-lanthaler.com/hydra/api-demo/vocab#EntryPoint/users"
4) Perform a GET request on that URL with the name provided by the CLI
user

At first sight it doesn't seems very HATEOAS this approach. Instead of
hard coding URLs I assume a previous knowledge of the result's
structure (the media type I guess).

Maybe in step 4 my client application should parse the vocabulary of
EntryPoint/users, look for an specific operation (let's say
user_search) and if it exists, try to fulfill it mapping the received
name to some operation's parameter.

What are your thoughts about this?


Many thanks!
--
Miguel

Received on Monday, 10 August 2015 06:50:12 UTC