An error has occurred: Unmarshalling Error: For input string: "param1"

2,257 views
Skip to first unread message

Daniel Gómez

unread,
Aug 29, 2012, 7:20:10 AM8/29/12
to adwor...@googlegroups.com
Hi there,
I have started using AdWords API, so far I have been able to use all the Basic Operations. However now I am trying to use AdParameteres for the Ads been unsuccessful so far. 

I have created a campaign, an Ad group, 4 keywords and 1 ad.
The Ad:

Headline: This test title
description1: This test {param1:$20}
description2: for ads {param2:50}
displayUrl: www.example.com

The code I am using is:

  $adParamService = $user->GetService('AdParamService', 'v201206');

  // Create ad parameters.
  $adParam1 = new AdParam($adGroupId, $keywordId, '$80', 1);  //keywordId existing under the same AdGroup
  $adParam2 = new AdParam($adGroupId, $keywordId, '18', 2);   //keywordId existing under the same AdGroup

  // Create operations.
  $operation1 = new AdParamOperation($adParam1, 'SET');
  $operation2 = new AdParamOperation($adParam2, 'SET'); 

  // Make the mutate request.
  $adParams = $adParamService->mutate(array($operation1, $operation2));

  // Display results.
  foreach ($adParams as $adParam) {
    printf("Ad parameter with insertion text '%s' and parameter index '%s' "
        . "was set.\n", $adParam->insertionText, $adParam->paramIndex);
  }

try {
  // Get AdWordsUser from credentials in "../auth.ini"
  // relative to the AdWordsUser.php file's directory.
      $user = new AdwordsUser(
'./auth.ini',     // $authenticationIniPath
null,             // $email 
null,             // $password
null,             // $developerToken
null,             // $applicationToken
null,             // $userAgent
null,             // $clientId
'./settings.ini' // $settingsIniPath
);

  // Log every SOAP XML request and response.
  $user->LogAll();

  // Run the example.
  SetAdParametersExample($user, $adGroupId, $keywordId);
} catch (Exception $e) {
  printf("An error has occurred: %s\n", $e->getMessage());
}


However every time I try to execute the script it always returns:
An error has occurred: Unmarshalling Error: For input string: "param1" 

I havent been able to find any help on this issue or similar problem.

I would really appreciate your help as I have been on this matter for couple of days already.

Kevin Winter

unread,
Sep 4, 2012, 5:01:35 PM9/4/12
to adwor...@googlegroups.com
Hi,
  Unfortunately, we need to update the AdParam example for PHP.  In v201206, a new field was added to many constructors, which means the examples need to be changed.  You can see more detail here: https://groups.google.com/d/msg/adwords-api/A9m4SB-Jmtc/DhyILEXnqv4J

I'm not sure which parameter needs to be changed, but the problem is you'll need to add an extra parameter to the constructor.  We're working on publishing a fix for this example.

- Kevin Winter
AdWords API Team
Reply all
Reply to author
Forward
0 new messages