Marketo REST API - 更新登陆页面模板 - 系统错误 611
Marketo REST API - Update Landing Page Templates - System error 611
我尝试使用(Marketo 文档页面:) Update Landing Page Template Content by Id 上的 PHP 示例片段替换我的 REST API URL、client_id, client_secret, 和一个简单的模板文件。结果它只是产生 bool(false)。
当我使用稍微不同的等价物时,我发现我的 REST 调用导致... object(stdClass)#3 (3) { ["requestId"]=> string( 16) "e714#153c7bf644f" ["success"]=> 布尔(假) ["errors"]=> 数组(1) { [0]=> 对象(stdClass)#4 (2) { [ "code"]=> 字符串(3) "611" ["message"]=> 字符串(12) "System error" } } }
神秘的错误代码 611 是怎么回事 - 它的真正含义是什么,因为 "system error" 没有足够的帮助来了解 - 为什么会在这种情况下发生?
用于更新着陆页模板的 REST API 实际上仍然有效吗?
<?php
/*
Some other functions that made use of $lp_template_id are up here
*/
$landingPageTemplate = new UpdateLandingPageTemplateContent();
$landingPageTemplate->id = 1234;
$landingPageTemplate->content = new CURLFile("/path_to_my_template/{$lp_template_id}", "text/html", "content");
print_r($landingPageTemplate->postData());
class UpdateLandingPageTemplateContent{
private $host = "https://xxx-xxx-xxx.mktorest.com";
private $clientId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
private $clientSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
public $id;//id of the teplate to update
public $content; //HTML content of Template, required
public function postData(){
$url = $this->host . "/rest/asset/v1/landingPageTemplate/" . $this->id . "/content.json?access_token=" . $this->getToken();
$ch = curl_init($url);
$requestBody = array("content" => $this->content);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('accept: application/json','Content-Type: multipart/form-data'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $requestBody);
curl_getinfo($ch);
$response = curl_exec($ch);
return $response;
}
private function getToken(){
$ch = curl_init($this->host . "/identity/oauth/token?grant_type=client_credentials&client_id=" . $this->clientId . "&client_secret=" . $this->clientSecret);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('accept: application/json',));
$response = json_decode(curl_exec($ch));
curl_close($ch);
$token = $response->access_token;
return $token;
}
}
我只是在提供文件路径方面做了一个简单的编程。
$landingPageTemplate->content = new CURLFile("/path_to_my_template/{$lp_template_id}", "text/html", "content");
应该是
$landingPageTemplate->content = new CURLFile("/path_to_my_template/{$landingPageTemplate->id}", "text/html", "content");
我尝试使用(Marketo 文档页面:) Update Landing Page Template Content by Id 上的 PHP 示例片段替换我的 REST API URL、client_id, client_secret, 和一个简单的模板文件。结果它只是产生 bool(false)。
当我使用稍微不同的等价物时,我发现我的 REST 调用导致... object(stdClass)#3 (3) { ["requestId"]=> string( 16) "e714#153c7bf644f" ["success"]=> 布尔(假) ["errors"]=> 数组(1) { [0]=> 对象(stdClass)#4 (2) { [ "code"]=> 字符串(3) "611" ["message"]=> 字符串(12) "System error" } } }
神秘的错误代码 611 是怎么回事 - 它的真正含义是什么,因为 "system error" 没有足够的帮助来了解 - 为什么会在这种情况下发生?
用于更新着陆页模板的 REST API 实际上仍然有效吗?
<?php
/*
Some other functions that made use of $lp_template_id are up here
*/
$landingPageTemplate = new UpdateLandingPageTemplateContent();
$landingPageTemplate->id = 1234;
$landingPageTemplate->content = new CURLFile("/path_to_my_template/{$lp_template_id}", "text/html", "content");
print_r($landingPageTemplate->postData());
class UpdateLandingPageTemplateContent{
private $host = "https://xxx-xxx-xxx.mktorest.com";
private $clientId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
private $clientSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
public $id;//id of the teplate to update
public $content; //HTML content of Template, required
public function postData(){
$url = $this->host . "/rest/asset/v1/landingPageTemplate/" . $this->id . "/content.json?access_token=" . $this->getToken();
$ch = curl_init($url);
$requestBody = array("content" => $this->content);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('accept: application/json','Content-Type: multipart/form-data'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $requestBody);
curl_getinfo($ch);
$response = curl_exec($ch);
return $response;
}
private function getToken(){
$ch = curl_init($this->host . "/identity/oauth/token?grant_type=client_credentials&client_id=" . $this->clientId . "&client_secret=" . $this->clientSecret);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('accept: application/json',));
$response = json_decode(curl_exec($ch));
curl_close($ch);
$token = $response->access_token;
return $token;
}
}
我只是在提供文件路径方面做了一个简单的编程。
$landingPageTemplate->content = new CURLFile("/path_to_my_template/{$lp_template_id}", "text/html", "content");
应该是
$landingPageTemplate->content = new CURLFile("/path_to_my_template/{$landingPageTemplate->id}", "text/html", "content");