What is the OData response structure behavior when using expand?
Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.
- SAP SuccessFactors HXM Suite
- OData API
When you have a field in the response of your OData query which is originated from a navigation (expand), the expected behavior of OData is to write it as below:
https://apisalesdemo4.successfactors.com/odata/v2/Position?$select=code,parentPosition/code&$expand=parentPosition&$filter=code eq '5000359'
Response in XML
Response in JSON
It will always write the name of the navigation (parentPosition) and inside its tag (the lines below it, inside the brackets), the fields that were requested in the $select parameter (in this case "code" field). If no specific fields from the navigation are requested in the $select (if you just put as $select=parentPosition), all fields from the parentPosition record will be returned inside its tag.
This is the standard behavior and can't be changed.
structure, navigation, relation, relationship, expand, query, api, odata, sf, successfactors, result, response, request, , KBA , LOD-SF-INT-ODATA , OData API Framework , How To