Querying a Complex Object

Not applicable

Hello,

We are designing a new API and are thinking through our strategy for enabling developers to query certain endpoints which will ultimately return complex nested objects.

What is the best way to enable developers to query based upon complex objects? For example:

http://api.ourdomain.com/resource/q?Class.Name='some value'

Because the 'Name' field is a part of the class sub-object of the resource.

Does that pattern make sense? (putting a '.' (period) inside of a query statement like that to reference a sub-object)? This feels right and makes sense to our dev team, but I haven't been able to find any other APIs that use this pattern.

Thanks!

0 1 161
1 REPLY 1

nmallesh
Participant V

Hi,

The best practices for designing REST Apis are to have an entity defined in the path.

For instance, considering your requirements - it is better to design your APIs the following way -

http://api.ourdomain.com/resource/class/q?name='some value'.


Hope this helps.

Thank You