如何构建同一键的多个值的 URI 查询?

发布于 2024-09-11 01:43:28 字数 326 浏览 3 评论 0原文

我正在尝试构造一个通过 id 访问我的数据的 URI。

目前,我的 URI 是基于查询的,如下所示:

.../content?parentList=15&type=note

如何构建类似的 URI,以便可以在多个列表中查询注释?

本质上是结合接下来两个 URI 的结果。

.../content?parentList=15&type=note
.../content?parentList=16&type=note

有没有标准的方法来做到这一点?

I'm trying to structure a URI that accesses my data by id.

Currently my URIs are query based like so:

.../content?parentList=15&type=note

How could I structure a similar URI so that I could query for notes in multiple lists?

Essentially combining the results of the next two URIs.

.../content?parentList=15&type=note
.../content?parentList=16&type=note

Is there a standard way to do this?

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

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

发布评论

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

评论(2

眼中杀气 2024-09-18 01:43:28

根据 URI 模板规范(第 3.6 节)的当前草案7),你可以这样做:

.../content?parentList=15,16&type=note

According to the current draft of the URI Template spec (Section 3.6 on page 7), you could do:

.../content?parentList=15,16&type=note
如日中天 2024-09-18 01:43:28

URI 的查询部分不要求每个参数仅出现一次。只需重复查询即可:

.../content?parentList=15&parentList=16&type=note

它也是 URI 模板互联网草案的一部分:

{?list+}

变为

?list=val1&list=val2&list=val3 

The Query portion of the URI doesn't require each parameter to occur only once. Just repeat the query:

.../content?parentList=15&parentList=16&type=note

It is also part of the URI template internet draft:

{?list+}

becomes

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