REST 结构,其中“可发现性”不可能

发布于 2025-01-07 20:21:55 字数 757 浏览 1 评论 0原文

我很难弄清楚如何最好地定义 REST/HATEOAS 服务的任何选项,由于可用资源选项的数量巨大,不可能详尽地列出可用的资源选项。

特别是,系统的一部分将是大型文本语料库中索引单词使用统计的资源 - 类似于 GET http ://mysite.org/word_statistics/foobar 返回有关 foobar 的信息以及使用 foobar 的文档的 URI。

但是,我无法提供任何合理的方式让应用程序可以发现实际的 http://mysite.org/word_statistics/ foob​​ar 链接 - 规范的方法似乎是提供类似 http://mysite.org/word_statistics 将返回单个 URI 的列表,但在我的例子中,该列表将大约为 1 GB,因此不太实用。因此,我需要为请求应用程序提供类似 http://mysite.org/word_statistics/{your_query_here但似乎没有 RESTful 方法可以做到这一点。

这应该如何正确完成?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半﹌身腐败 2025-01-14 20:21:55

我只会遵循许多地方使用的经典搜索模式。

您还可以执行以下操作:

  • http://example.org/{document}/words -- 返回单词这些内容就在该文档中,并附有其统计数据的链接。

您可以在这里做各种各样的事情。但是,要点是基本的搜索模式应该很容易满足需求。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文