I have a web api 2.2 that is configured for OData v4. I want to return a user by ID and include only the user group Id's that the user is a member of. When I do this
http://localhost/User?$filter=id eq 312&$select=*,userGroups/id&$expand=userGroups
I get this error
The query specified in the URI is not valid. Found a path with multiple navigation properties in a select clause. Please reword your query such that each level of select or expand only contains either TypeSegments or Properties.
Found a path with multiple navigation properties in a select clause. Please reword your query such that each level of select or expand only contains either TypeSegments or Properties.
The query will execute if I remove ",userGruops/id"
You should write your query like this:
http://localhost/User?$filter=id eq 312&$select=*&$expand=userGroups($select=id)
By the way, you can also remove the $select=*
segment as all non-navigation properties are by default included in the response.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With