2016-04-01 15 views
0

私のREST API URL、client_id、client_secret、およびシンプルなテンプレートファイルを代わりに使って、Marketo doc page:Update Landing Page Template Content by IdにPHPサンプルスニペットを使用しようとしました。その結果、bool(false)が生成されます。 オブジェクト(stdClass)#3(3){["requestId"] =>文字列(16) "e714#153c7bf644f"この場合、 "[success"] => bool(false)["errors"] =>配列(1){[0] =>オブジェクト(stdClass)#4(2){["code"] => string(3) " "システムエラー"が十分に役に立たないため、実際にはどういう意味ですか?611 "[" message "] => string(12)"システムエラー "}}}Marketo REST API - ランディングページテンプレートの更新 - システムエラー611

謎のエラーコード611知っている - なぜこの場合に起こっているのですか?

ランディングページテンプレートを更新するこの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; 
    } 

} 
+0

になるはずだった、C#のスニペットは、魔法のように動作します。 – starlocke

+0

あなたのクライアントIDと秘密が編集された完全なリクエストがどのように見えるのかを表示できますか? – kelkington

答えて

0

ファイルへのパスを提供する簡単なプログラミングを作成しました。

$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");