Ashisha Nautiyal
Ashisha Nautiyal

Reputation: 1397

Query string for nested multiselect

I have a situation where I have nested multi-select.

   1.Football
   1.1 Messi
   1.2 Ronaldo
   1.3 Neymar
   2. Tenis
   2.1  Novak Djokovic
   2.2  Fedrer
   2.3  Messi

and I want to create an endpoint for this query which can fetch multiplayer. If it would be just one single select in-game and single select in the player then I could do

  1. ?game=tennis&player=Messi

  2. ?game=Football&player=Messi

    But I need a single endpoint which can fetch multiplayer in multiple games. Please suggest

Upvotes: 1

Views: 32

Answers (1)

cassiomolin
cassiomolin

Reputation: 130957

Not sure if I properly understand what your issue is, but you could do:

?game=tennis,football&player=messi,fedrer
?game=tennis&game=football&player=messi&player=fedrer

But you must be aware that, the query string, by definition, is non-hierarchical:

3.4. Query

The query component contains non-hierarchical data that, along with data in the path component, serves to identify a resource within the scope of the URI's scheme and naming authority (if any). The query component is indicated by the first question mark (?) character and terminated by a number sign (#) character or by the end of the URI. [...]

Upvotes: 1

Related Questions