Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

"oData Query to read complex type"

ravenclaw
Participant
0 Kudos

Hello All,

I am trying to do the following Query -

https://services.odata.org/V4/TripPinService/People('russellwhyte')/AddressInfo

The below query returns a correct response like below -

Now I am trying to read the property - "City" which is a complexType using the query - https://services.odata.org/V4/TripPinService/People('russellwhyte')/AddressInfo/City.

The result is an internal server error -

How do I read it correctly? Thank you.

Best Regards,

Tanmoy

1 REPLY 1

evanireland
Advisor
Advisor

Note that the "value" in the first response is an array of addresses (and the second, error, response indicates that the AddressInfo is a collection of complex types, not a single complex type instance).

If you request "AddressInfo/City" it's a bit like asking "what is the surname of all the people in the neighboring town".

The answer would either be "ambiguous" (or perhaps "none" if there are no people in the neighboring town) or it would be an array of surnames.

In any case, my advice would be to just fetch the https://services.odata.org/V4/TripPinService/People('russellwhyte') and have your own client program extract form that the info that you want, whether it is the City from the first address, the City from the last address, all the cities, or some other info.