开发者

How to structure URI query for multiple values for same key?

开发者 https://www.devze.com 2023-01-08 03:05 出处:网络
I\'m trying to structure a URI that accesses my data by id. Currently my URIs are query based like so:

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 c开发者_如何学JAVAould 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?


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


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 
0

精彩评论

暂无评论...
验证码 换一张
取 消