I am using the Cleaver Reach API in Magento 2. I used the create mailing API to create the mailing content using PHP curl. I need to update the mailing content using API. I assigned the template in the clevereach dashboard to the email content section. Now I want to update the mailing content using API and also want to retain the template data in the mailing content. I am using the following code to update the mailing content:
/* update the mailing content by id*/
$cleverreachmailingurl='https://rest.cleverreach.com/v3/mailings.json/<id>';
$this->_curl->setOption(CURLOPT_HEADER, 0);
$this->_curl->setOption(CURLOPT_TIMEOUT, 60);
$this->_curl->setOption(CURLOPT_RETURNTRANSFER, true);
$this->_curl->setOption(CURLOPT_CUSTOMREQUEST, 'PUT');
$headers = ["Content-Type" => "application/json","Authorization"=>
"Bearer Bearer <token>"];
$params='{
"content": {
"type": "html/text",
"html": "<h4>Test 15</h4>'.$rr.'",
"text": "Test content for the code"
}
}';
$this->_curl->setHeaders($headers);
$this->_curl->post($cleverreachmailingurl, $params);
$response = $this->_curl->getBody();
$datafindAddressApidecode = json_decode($response, true);
/* update the mailing content by id end*/
This is the body response i need to update the body_html section but when i getting the decode value for the body_html then showing the /n/n/n/t values.
I am using this API to update the cleavreach email content. https://rest.cleverreach.com/v3/mailings/template.json/> But when I update and add the new data the old template data is not retained.