cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Can't create message: Message content can only be created for default language 'EN'.

Former Member
0 Likes
378

Hello dear experts,

Could you help me please.I've tried to create new messages using endpoint /sap/opu/odata/sap/API_MKT_CAMPAIGN_MESSAGE_SRV/Messages with provided JSON and got 400 response with message "Message content can only be created for default language 'EN'." Do you have any examples of data that I can use for creating new messages? Or do you have any idea what is wrong with my data?

JSON:

{
  "MessageName": "stringstringstring2",
  "MarketingArea": "CXXGLOBAL",
  "DefaultLanguage": "EN",
  "IsTemplate": false,
  "MessageContents": {
    "results": [
      {
        "MessageBlocks": {
          "results": [
            {
              "BlockType": "TEXT",
              "MessageBlockContents": {
                "results": [
                  {
                    "BlockContentConditionName": "",
                    "BlockContentHTMLString": "something",
                    "BlockPosition": 0,
                    "BlockContentType": "TEXT",
                    "BlockContentStyleClasses": "",
                    "BlockControl": "",
                    "BlockControlName": ""
                  }
                ]
              }
            }
          ]
        }
      }
    ]
  }
}

Error:

{
  "error": {
    "code": "CL_API_MKT_CPG_MSG/011",
    "message": {
      "lang": "en",
      "value": "Message content can only be created for default language "EN"."
    },
    "innererror": {
      "application": {
        "component_id": "CEC-MKT-API",
        "service_namespace": "/SAP/",
        "service_id": "API_MKT_CAMPAIGN_MESSAGE_SRV",
        "service_version": "0001"
      },
      "transactionid": "<transactionid>",
      "timestamp": "",
      "Error_Resolution": {
        "SAP_Transaction": "",
        "SAP_Note": "See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)"
      },
      "errordetails": [
        {
          "code": "CL_API_MKT_CPG_MSG/011",
          "message": "Message content can only be created for default language "EN".",
          "propertyref": "",
          "severity": "error",
          "transition": false,
          "target": ""
        }
      ]
    }
  }
}

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member

Thank you! This works!

Also there is easier way to create message with content:

{
"MessageName": "string",
"MessageType": "EM",
"MarketingArea": "CXXGLOBAL",
"DefaultLanguage": "EN",
"MessageContents": {
"results": [
{
"LanguageCode":"EN",
"MessageContentHTMLString":"<!DOCTYPE html>\n<html ......"
}
]
}
}
radim_vongrej
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi Sergei,

add "LanguageCode":"EN" before MessageBlocks. It should work.

regards, Radim

 {
  "MessageName": "stringstringstring2",
  "MarketingArea": "CXXGLOBAL",
  "DefaultLanguage": "EN",
  "IsTemplate": false,
  "MessageContents": {
    "results": [
      {
      	"LanguageCode":"EN",
        "MessageBlocks": {
          "results": [
            {
              "BlockType": "TEXT",
              
              "MessageBlockContents": {
                "results": [
                  {
                    "BlockContentConditionName": "",
                    "BlockContentHTMLString": "something",
                    "BlockPosition": 0,
                    "BlockContentType": "TEXT",
                    "BlockContentStyleClasses": "",
                    "BlockControl": "",
                    "BlockControlName": ""
                  }
                ]
              }
            }
          ]
        }
      }
    ]
  }
}