Symptom
You have a requirement to suppress "__metadata" object from response in OData call in C4C.
Environment
SAP Cloud for Customer
Reproducing the Issue
- Call any standard OData API.
- For Example "https://myXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/CorporateAccountCollection" to query Accounts
- Observe the response which includes the "__metadata" object for the JSON response.
{
"d": {
"results": [
{
"__metadata": {
"uri": "https://myXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/CorporateAccountCollection('XXXXXXXXXXXXXXXXX')",
"type": "c4codata.CorporateAccount",
Cause
This is not possible with OData Version 2.0
Resolution
The __metadata block is mandatory in OData Version 2.0 responses and includes information like the URI and type of the entity.
Keywords
odata, json, response, suppress, __metadata, sap c4c, odata api, metadata block, odata v2, odata v4, sap cloud for customer , KBA , LOD-CRM-INT-API , OData API (C4C Only) , Problem
SAP Knowledge Base Article - Public