-
Notifications
You must be signed in to change notification settings - Fork 2
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
Comments
Re: [dataproboston/marketing-cloud-php-sdk] Creating a Row in a Data Extension fails (#1)
Hello Josh,
Thanks for your feedback.
I'll try to repeat this problem and fix it.
I'll send you updates tomorrow.
…----------------------
Best regards,
Yaroslav Honcharuk
Skype: nexus.xs
GSM: +380 67 505 17 41
Wednesday, April 12, 2017, 4:45:17 PM, you wrote:
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'
]
]
]
];
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!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Re: [dataproboston/marketing-cloud-php-sdk] Creating a Row in a Data Extension fails (#1)
Hello Josh,
I see that your input array has wrong format - indexes in it are not string, but arrays.
It should look like this:
$object = [
'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'
]
]
]
];
I assume, it should work.
However, as I just discovered, Marketing Cloud doesn't returns any identifiers for
created 'DataExtensionObject', so SoapClient will raise an exception
No identifier found for result:
I'll publish path for this case soon. Now, for DataExtensionObject you can catch ResponseException, check
if message starts with "No identifier found for result", and ignore it, if true.
…----------------------
Best regards,
Yaroslav Honcharuk
Skype: nexus.xs
GSM: +380 67 505 17 41
Wednesday, April 12, 2017, 4:45:17 PM, you wrote:
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'
]
]
]
];
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!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Thanks @yaroslav-honcharuk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
And when ran it returns this error:
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!
The text was updated successfully, but these errors were encountered: