I have trouble figuring out any option on how to best define a REST/HATEOAS service where exhaustively listing available resource options is not a possibility due to the huge number of them.

In particular, a part of the system would be resources for indexed word usage statistics in a large corpus of text - something like GET http://mysite.org/word_statistics/foobar that returns information on foobar and URI's to documents where foobar is used.

However, I can't provide any reasonable way where the app might discover the actual http://mysite.org/word_statistics/foobar link - the canonical approach seems to be to provide a resource like http://mysite.org/word_statistics that would return a list of the individual URI's, but in my case that list would be around a gigabyte, so not reasonably practical. So I'd need to give the requesting app something like http://mysite.org/word_statistics/{your_query_here}, but there seems to be no RESTful way to do that.

How should this be done properly?

有帮助吗?

解决方案

I would just follow the classic search pattern used in many places.

You could also do something like:

  • http://example.org/{document}/words -- that returns the words that are just in that document, with links to their statistics.

All sorts of things you can do here. But, the gist is that a basic search pattern should fill the need readily.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top