SAP Knowledge Base Article - Public

3632992 - Suppression of "__metadata" in OData JSON responses in C4C

Symptom

You have a requirement to suppress "__metadata" object from response in OData call in C4C.

Environment

SAP Cloud for Customer

Reproducing the Issue

  1. Call any standard OData API.
  2. For Example "https://myXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/CorporateAccountCollection" to query Accounts
  3. 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

Product

SAP Cloud for Customer core applications all versions