-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EntryPoint question #155
Comments
Both are totally valid. The advantage of the approach used in the use case document is that you won’t have to invent your own properties such as “events”, “issues” etc. that no one else will understand. Instead you can leverage the existing types. You would retrieve the entry point and then look for a collection that manages objects of the desired type, e.g., schema:Event.
Collections are subclasses of hydra:Resource which means they are de-referenceable. In other words, yes, you should assume that such entities can be retrieved with a GET.
|
@alien-mcl, might be worth adding a test showing how this works and include that also in the use case document. WDYT? |
Sure thing - I'll try to set it up. Still, I'm somehow confused with what @paul wrote in his |
BTW. I've reviewd history of that 1.entry-point.md and it seems that at the very beginning indeed entryPoint had one relation named After some changes this relation was extended with two more pointed resources. I feel that generic |
Oh, I see! So am I correct that the @alien-mcl I was also digging through the history of As for my "issues" example, let me be more specific. Lets say I'm writing a command-line tool that will import all Issues from the system described by the API and do something with them (save them to a local database, tweet about them, or publish them to another API). In a dumb CRUD API, I would write a client like In the EntryPoint given in the 1.entry-point.md, I'm not sure how to do that. I was mistakenly trying to "select" the Issues item from the |
We introduced the client
.retrieve("http://example.com/")
.resources()
.ofType("hydra:Collection")
.where(resource => resource[hydra.manages][hydra.property] == rdf.type
&& resource[hydra.manages][hydra.object] == schema.Event);
.first()
.members()
.each( ... ); or, if you would like to make client a bit more aware of Hydra client
.retrieve("http://example.com/")
.collections()
.thatManageMembersOfType(schema.Event)
.first()
.members()
.each( ... ); |
I see. So its expected that there will only ever be one resource in that collection that What does it look like if the EntryPoint links to something that's not a collection? "Invent a property", like you said? |
As for the test mentioned, I think there is already such one. In the integration tests suite, file served as an entry point contains two collections exposed with |
@alien-mcl I'm sorry, I'm not sure I'm following. That Heracles test EntryPoint has two links, both as top-level items. The EntryPoint in the use-case document has a "collection" top-level attribute as an array of collection items. The Heracles EntryPoint as the advantage of having a simple "key" that can be used to find the item ( I'm also not sure how to link to a resource that is not a collection in the use-case EntryPoint style, I think the docs could use an example of that. |
A collection with multiple manage blocks would be able to describe that:
At the moment, yes. We actually didn't discuss this much so far. |
Indeed - doesn't really matter what is the name of the relation. Current reference client hooks up the
Here it is. Probably it may be incorrect by means the use case uses
There is a new unit test here that uses some (nested) resources with a custom link. Current implementation assumes that the relation must be marked with |
It does (unless there are other means such as |
Yes - |
* Introduced a collections helper property on IHypermediaContainer as mentioned in HydraCG/Specifications#155. * Added support for hydra:collection predicate * Expanded support for hydra:collection to other that hydra:EntryPoint resources. * Minor changes after code review * Minor changes after code review * Typo change * Merge branch 'master' of https://github.com/HydraCG/Heracles.ts into Specification/issue-155_EntryPoint_question
I'm having trouble figuring out the "correct" way to have an EntryPoint. The use-cases documentation for Entry Point 1.entry-point.md has an example where all the links are inside a
"collection"
attribute. The Hydra Console demo app has instead the links as attributes at the root level. I assume that the use-case example is just newer, and top-level attributes is no longer the correct way to do it?I think however, the newer "style" is not as useful because there's no human-friendly "name" by which to find the link. For example, if I'm scripting a client to go get all the Issues from the entry point, in the old style I just look for "issues" attribute. In the new style, though, if I want to do the same for Events, I'm not even sure what to look for.
@id
is[http://example.com]/api/events
, and"title"
is a totally human "List of Events". There's themanages.object
attribute with"schema:Event"
, but I think this just says that this collection is a collection of Events. Ideally, I'd be able to tell my client "go look in the entry point document for"events"
(or"allEvents"
or something) and follow that URL". There doesn't seem to be any way to do that in the current scheme.Sort of tangentially related, I also notice that the
supportedOperations
for all the entry point items are always "POST". Is a "GET" operation on all URLs just always assumed to be possible? If so, how do I specify a resource to only support POST, and disallow GET?The text was updated successfully, but these errors were encountered: