cancel
Showing results for 
Search instead for 
Did you mean: 

Fetching Metadata along with Query/Get opertation

vishnu_gk
Explorer
0 Kudos

Hi All,

I have following questions.

1. I have a requirement to fetch Metadata of the Entity along with the GetEntity/EntitySet operation

Is there any way out for this? url service

/sap/opu/odata/SAP/ZTEST_FLIGHT_SRV/carrierSet?$metadata (This is giving only the fetched data I also need EDM details).

2. Metadata definition of the project gives all the details of EDM types in XML only, Is there any way to obtain the same data in Json format?

Url Service used

/sap/opu/odata/SAP/ZTEST_FLIGHT_SRV/?$metadata

tried using

/sap/opu/odata/SAP/ZTEST_FLIGHT_SRV/?$format=json (This gives only entityset details not the EDM details)

Please help me on this

Thanks

Vishnu

Accepted Solutions (1)

Accepted Solutions (1)

AshwinDutt
Active Contributor
0 Kudos

Hello Vishnu,

1. With URL /sap/opu/odata/SAP/ZTEST_FLIGHT_SRV/carrierSet?$metadata, you will only get the data not the Edm details. As far as i know a single response having both data and Edm details is not possible.

2. Fetching metadata in JSON is not supported.

URL /sap/opu/odata/SAP/ZTEST_FLIGHT_SRV/?$format=json will return all entity set details which is the correct observation.

Regards,

Ashwin

Answers (1)

Answers (1)

former_member184867
Active Contributor
0 Kudos

Regarding Question 1: it is  not possible to get metadata along with response in OData V2.

The reason is metadata does not change so one can get the metadata and utilize if for understanding of any kind of data under the same odata service. It is not required to fire metadata call with every Data request.  Also from server point of view metadata calls are expensive in nature.  

Also this is how UI5 works.