Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a Row in a Data Extension fails #1

Open
jgulledge19 opened this issue Apr 12, 2017 · 3 comments
Open

Creating a Row in a Data Extension fails #1

jgulledge19 opened this issue Apr 12, 2017 · 3 comments

Comments

@jgulledge19
Copy link

jgulledge19 commented Apr 12, 2017

Thanks for the library!

I am trying to use your project instead of the FuelSDK to add rows to Data Extensions. Here is the basics of the code:

/** @var \DataProBoston\MarketingCloud\AuthClient $authClient */
$authClient = new AuthClient([
    'clientId' => $client_id,
    'clientSecret' => $client_secret,
]);
/** @var DataProBoston\MarketingCloud\SoapClient $client */
// $client = new DE(null, [], $authClient);
$client = new SoapClient(null, [], $authClient);

// Columns match the existing Data Extension 
$objects = [
    ['CustomerKey'] => 'TestExternalKey',
    ['Properties'] => [
        ['Property'] => [
            [
                'Name' => 'Contact_ID',
                'Value' => 123
            ],
            [
                'Name' => 'Email_Address',
                'Value' => 'user@email.com'
            ],
            [
                'Name' => 'First_Name',
                'Value' => 'Test'
            ],
            [
                'Name' => 'Last_Name',
                'Value' => 'API User'
            ]
        ]
    ]
];
// UPDATE fixed the error with Name/Value being arrays not keys.

try {
    $rowId = $client->create('DataExtensionObject', $objects);
} catch (Exception $e) {
    echo 'Response ERROR: '.$e->getMessage();
    echo '<pre>'.$e->getTraceAsString().'</pre>';
}

And when ran it returns this error:

Response ERROR: Unable to execute SOAP request: Server error: `POST https://webservice.exacttarget.com/Service.asmx` resulted in a `500 Internal Server Error` response:
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="h (truncated...)

#0 [internal function]: DataProBoston\MarketingCloud\SoapClient->__doRequest('<?xml version="...', 'https://webserv...', 'Create', 1, 0)
#1 /vendor/dataproboston/marketing-cloud-php-sdk/src/SoapClient.php(516): SoapClient->__soapCall('Create', Array)
#2 /vendor/dataproboston/marketing-cloud-php-sdk/src/SoapClient.php(679): DataProBoston\MarketingCloud\SoapClient->soapCall('Create', Array)
#3 /vendor/dataproboston/marketing-cloud-php-sdk/src/SoapClient.php(657): DataProBoston\MarketingCloud\SoapClient->objectsSoapCall('Create', 'DataExtensionOb...', Array, Object(Closure))
#4 /vendor/dataproboston/marketing-cloud-php-sdk/src/SoapClient.php(299): DataProBoston\MarketingCloud\SoapClient->cudObjectsSoapCall('Create', 'DataExtensionOb...', Array, false)
#5 myfile.php(203): DataProBoston\MarketingCloud\SoapClient->create('DataExtensionOb...', Array)

I am able to get similar code to work in the old FuelSDK-PHP. I also printed out the $request in the SoapClient->__doRequest method and it is the same minus the OAuth of the $content in ET_Client. Is the guzzle body parameter need to be something else?

Thanks for reviewing! Any help is appreciated!

@yarhon
Copy link
Owner

yarhon commented Apr 12, 2017 via email

@yarhon
Copy link
Owner

yarhon commented Apr 13, 2017 via email

@jgulledge19
Copy link
Author

Thanks @yaroslav-honcharuk
I couldn't get it to work. I will review again in a month or two. I can't devote any more time to this right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants