Create DynamoDB table with Global Secondary Index - php

I'm new to AWS DynamoDB and to nosql in general, and I'm having problem with table creation.
I'm trying to create a table named User with the following Attributes:
UserId (HASH)
OSType (RANGE)
MSISDN
IMSI
DeviceID
I need to query the table not only by UserId, but also by the following fields:
MSISDN
IMSI
DeviceID
My Logic is as follows:
Query the table by the UserId field.
If the query returned no results create a new one, but check that there isn't other users with the same MSISDN filed OR the same IMSI field OR the same DeviceID field.
After reading the manual about LSI/GSI i'm having difficulties understating how to create the table and define those indexes.
This is the code i'm tring to execute to creater the table using PHP+AWS SDK:
$client->createTable(array(
'TableName' => 'User',
'AttributeDefinitions' => array(
array('AttributeName' => 'UserId', 'AttributeType' => 'S'),
array('AttributeName' => 'OSType', 'AttributeType' => 'S'),
array('AttributeName' => 'MSISDN', 'AttributeType' => 'S'),
array('AttributeName' => 'IMSI', 'AttributeType' => 'S'),
array('AttributeName' => 'DeviceID', 'AttributeType' => 'S'),
),
'KeySchema' => array(
array('AttributeName' => 'UserId', 'KeyType' => 'HASH'),
array('AttributeName' => 'OSType', 'KeyType' => 'RANGE')
),
'GlobalSecondaryIndexes' => array(
array(
'IndexName' => 'IMSIIndex',
'KeySchema' => array(
array('AttributeName' => 'IMSI', 'KeyType' => 'HASH')
),
'Projection' => array(
'ProjectionType' => 'KEYS_ONLY',
),
'ProvisionedThroughput' => array(
'ReadCapacityUnits' => 10,
'WriteCapacityUnits' => 10
)
),
array(
'IndexName' => 'MSISDNIndex',
'KeySchema' => array(
array('AttributeName' => 'MSISDN', 'KeyType' => 'HASH')
),
'Projection' => array(
'ProjectionType' => 'KEYS_ONLY',
),
'ProvisionedThroughput' => array(
'ReadCapacityUnits' => 10,
'WriteCapacityUnits' => 10
)
),
array(
'IndexName' => 'DeviceIDIndex',
'KeySchema' => array(
array('AttributeName' => 'DeviceID', 'KeyType' => 'HASH')
),
'Projection' => array(
'ProjectionType' => 'KEYS_ONLY',
),
'ProvisionedThroughput' => array(
'ReadCapacityUnits' => 10,
'WriteCapacityUnits' => 10
)
),
),
'ProvisionedThroughput' => array(
'ReadCapacityUnits' => 50,
'WriteCapacityUnits' => 50
)
));
I'm getting this error:
PHP Fatal error: Uncaught Aws\DynamoDb\Exception\ValidationException: AWS Error Code: ValidationException, Status Code: 400, AWS Request ID: 70LGIARTTQF90S8P0HVRUKSJ27VV4KQNSO5AEMVJF66Q9ASUAAJG, AWS Error Type: client, AWS Error Message: One or more parameter values were invalid: Number of attributes in KeySchema does not exactly match number of attributes defined in AttributeDefinitions, User-Agent: aws-sdk-php2/2.4.11 Guzzle/3.7.4 curl/7.29.0 PHP/5.4.14
Please help me understand what am I doing wrong. I want to create the table with GSI, but I just can't comprehend the essence of secondary index in DynamoDB :(

Only attributes that are included in local and global index should be defined in the AttributeDefinitions section.

This should work:
$client->createTable(array(
'TableName' => 'User',
'AttributeDefinitions' => array(
array('AttributeName' => 'UserId', 'AttributeType' => 'S'),
array('AttributeName' => 'OSType', 'AttributeType' => 'S')
),
'KeySchema' => array(
array('AttributeName' => 'UserId', 'KeyType' => 'HASH'),
array('AttributeName' => 'OSType', 'KeyType' => 'RANGE')
),
'GlobalSecondaryIndexes' => array(
array(
'IndexName' => 'IMSIIndex',
'KeySchema' => array(
array('AttributeName' => 'IMSI', 'KeyType' => 'HASH')
),
'Projection' => array(
'ProjectionType' => 'KEYS_ONLY',
),
'ProvisionedThroughput' => array(
'ReadCapacityUnits' => 10,
'WriteCapacityUnits' => 10
)
),
array(
'IndexName' => 'MSISDNIndex',
'KeySchema' => array(
array('AttributeName' => 'MSISDN', 'KeyType' => 'HASH')
),
'Projection' => array(
'ProjectionType' => 'KEYS_ONLY',
),
'ProvisionedThroughput' => array(
'ReadCapacityUnits' => 10,
'WriteCapacityUnits' => 10
)
),
array(
'IndexName' => 'DeviceIDIndex',
'KeySchema' => array(
array('AttributeName' => 'DeviceID', 'KeyType' => 'HASH')
),
'Projection' => array(
'ProjectionType' => 'KEYS_ONLY',
),
'ProvisionedThroughput' => array(
'ReadCapacityUnits' => 10,
'WriteCapacityUnits' => 10
)
),
),
'ProvisionedThroughput' => array(
'ReadCapacityUnits' => 50,
'WriteCapacityUnits' => 50
)));
Hope that helps

Related

Typo3 use realurl to mask tx_news_pi1 parameter in URL

I am pretty new to typo3. The Website is all set up now i want to use realurl to make some human readable URLS.
Out of the boy it works pretty well. But not for my news sites.
http://myDomain/news-events/news/Name-of-the-Article/?tx_news_pi1%5Bday%5D=19&tx_news_pi1%5Bmonth%5D=7&tx_news_pi1%5Byear%5D=2017&cHash=6af067caeb037b4de744f6b9e07b73e8
Please help me to get rid of the last Parameters.
to get something like:
http://myDomain/news-events/news/Name-of-the-Article/
Here is my realurl_conf
[ See Update]
Thank you all for your time =)
Update:
So i worked my way through the manual.
I copied from them and inserted my IDs and Stuff
this is my new Configuration [ Deleted the first one ]
<?php
$GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'] .= ',tx_realurl_pathsegment';
// Adjust to your needs
$domain = 'http://mydomain.de';
$rootPageUid = 1;
#$rssFeedPageType = 9818; // pageType of your RSS feed page
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'][$domain] = array(
'pagePath' => array(
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'expireDays' => '3',
'rootpage_id' => $rootPageUid,
'firstHitPathCache' => 1
),
'init' => array(
'enableCHashCache' => TRUE,
'respectSimulateStaticURLs' => 0,
'appendMissingSlash' => 'ifNotFile,redirect',
'adminJumpToBackend' => TRUE,
'enableUrlDecodeCache' => TRUE,
'enableUrlEncodeCache' => TRUE,
'emptyUrlReturnValue' => '/',
),
'fileName' => array(
'defaultToHTMLsuffixOnPrev' => 0,
'acceptHTMLsuffix' => 1,
'index' => array(
# 'feed.rss' => array(
# 'keyValues' => array(
# 'type' => $rssFeedPageType,
# )
# )
)
),
'preVars' => array(
array(
'GETvar' => 'L',
'valueMap' => array(
# 'en' => '1',
),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'no_cache',
'valueMap' => array(
'nc' => 1,
),
'noMatch' => 'bypass',
),
),
'fixedPostVars' => array(
'newsDetailConfiguration' => array(
array(
'GETvar' => 'tx_news_pi1[action]',
'valueMap' => array(
'detail' => '',
),
'noMatch' => 'bypass'
),
array(
'GETvar' => 'tx_news_pi1[controller]',
'valueMap' => array(
'News' => '',
),
'noMatch' => 'bypass'
),
array(
'GETvar' => 'tx_news_pi1[news]',
'lookUpTable' => array(
'table' => 'tx_news_domain_model_news',
'id_field' => 'uid',
'alias_field' => "CONCAT(uid, '-', IF(path_segment!='',path_segment,title))",
/** OR ***************/
'alias_field' => 'IF(path_segment!="",path_segment,title)',
/** OR ***************/
'alias_field' => "CONCAT(uid, '-', title)",
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1, # 1?
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-'
),
'languageGetVar' => 'L',
'languageExceptionUids' => '',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'expireDays' => 180,
),
#Depends ?
array(
'GETvar' => 'tx_news_pi1[day]',
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_news_pi1[month]',
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_news_pi1[year]',
'noMatch' => 'bypass',
),
),
'newsCategoryConfiguration' => array(
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][categories]',
'lookUpTable' => array(
'table' => 'sys_category',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-'
)
)
)
),
'newsTagConfiguration' => array(
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][tags]',
'lookUpTable' => array(
'table' => 'tx_news_domain_model_tag',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-'
)
)
)
),
#TODO: ID-News Seite Finden
#'145' => 'newsDetailConfiguration',
#'147' => 'newsDetailConfiguration', // For additional detail pages, add their uid as well
#'134' => 'newsDetailConfiguration', // For additional detail pages, add their uid as well
'148' => 'newsDetailConfiguration', // For additional detail pages, add their uid as well
'149' => 'newsDetailConfiguration', // For additional detail pages, add their uid as well
#'71' => 'newsTagConfiguration',
#'72' => 'newsCategoryConfiguration',
),
'postVarSets' => array(
'_DEFAULT' => array(
'controller' => array(
array(
'GETvar' => 'tx_news_pi1[action]',
'noMatch' => 'bypass'
),
array(
'GETvar' => 'tx_news_pi1[controller]',
'noMatch' => 'bypass'
)
),
'dateFilter' => array(
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][year]',
),
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][month]',
),
),
'page' => array(
array(
'GETvar' => 'tx_news_pi1[#widget_0][currentPage]',
),
),
),
),
)
);
But still there are the
tx_news_pi1[day], tx_news_pi1[month], tx_news_pi1[year] and cHash
Parameters in the URL.
Please Help me to get rid of them.
thats my configuration:
<?php
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']=array (
'_DEFAULT' => array (
'init' => array (
'appendMissingSlash' => 'ifNotFile,redirect',
'emptyUrlReturnValue' => '/',
),
'pagePath' => array (
'rootpage_id' => '2',
),
'fileName' => array (
'defaultToHTMLsuffixOnPrev' => 0,
'acceptHTMLsuffix' => 1,
'index' => array (
'print' => array (
'keyValues' => array (
'type' => 98,
),
),
),
),
'preVars' => array(
array(
'GETvar' => 'L',
'valueMap' => array(
'en' => '1',
),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'no_cache',
'valueMap' => array(
'nc' => 1,
),
'noMatch' => 'bypass',
),
),
'fixedPostVars' => array(
// config for single/detail news:
'newsDetailConfiguration' => array(
array(
'GETvar' => 'tx_news_pi1[action]',
'valueMap' => array(
'detail' => '',
),
'noMatch' => 'bypass'
),
array(
'GETvar' => 'tx_news_pi1[controller]',
'valueMap' => array(
'News' => '',
),
'noMatch' => 'bypass'
),
array(
'GETvar' => 'tx_news_pi1[news]',
'lookUpTable' => array(
'table' => 'tx_news_domain_model_news',
'id_field' => 'uid',
'alias_field' => 'concat(uid,\'_\',title)',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-'
),
'languageGetVar' => 'L',
'languageExceptionUids' => '',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'autoUpdate' => 1,
'expireDays' => 180,
)
)
),
// config for category selection:
'newsCategoryConfiguration' => array(
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][categories]',
'lookUpTable' => array(
'table' => 'sys_category',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-'
)
)
)
),
// configuration for tag selection:
'newsTagConfiguration' => array(
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][tags]',
'lookUpTable' => array(
'table' => 'tx_news_domain_model_tag',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-'
)
)
)
),
// add your page uids where you have detail view of news:
'70' => 'newsDetailConfiguration',
//'701' => 'newsDetailConfiguration', // For additional detail pages, add their uid as well
/connect page uid for further views: tag-selection, category-selection"
'71' => 'newsTagConfiguration',
'72' => 'newsCategoryConfiguration',
),
'postVarSets' => array(
'_DEFAULT' => array(
'controller' => array(
array(
'GETvar' => 'tx_news_pi1[action]',
'noMatch' => 'bypass'
),
array(
'GETvar' => 'tx_news_pi1[controller]',
'noMatch' => 'bypass'
)
),
'dateFilter' => array(
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][year]',
),
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][month]',
),
),
'page' => array(
array(
'GETvar' => 'tx_news_pi1[#widget_0][currentPage]',
),
),
),
),
),
);
look for the right insertion in the array. For that have a clean indention!
The already mentioned link is quite useful and contains detailed info:
https://docs.typo3.org/typo3cms/extensions/news/AdministratorManual/BestPractice/Realurl/Index.html
There are 3 ways explained there:
a basic one which still shows action and controller name as an URL path segment
an advanced example (the one Bernd Wilke is using in his sample as well)
a TypoScript solution to avoid controller and action name in URL
Option 2 can only be used if you show your detail news on a dedicated pages (separate page for list and detail view) as you configure a preset for a controller and action name for a special page (uid) - your news detail view.
Option 3 basically does the same as Option 2, but on a TypoScript level and it can be used in a case where list and detail view is on one single page.
Both options can / should be used in combination with the setting skipControllerAndAction = 1.
In case you want to use the basic setup. The postVarSets is on the same level as fixedPortsVars or preVars
Additional hint:
Do you use any other language than DE or EN as your default language? If so your default language has sys language uid of 0 and thus all good.
The default language usually has sys language uid of 0. If you do not need a default language path segment, you leave it out in our real url config thus it gets bypassed.
More info on language setup: https://github.com/dmitryd/typo3-realurl/wiki/Notes-for-Integrators#configuring-languages
RealUrl Doc:
https://github.com/dmitryd/typo3-realurl/wiki

Can’t filter search result

My Elasticsearch query is like that:
array(
'index' => 'myindex',
'type' => 'myindextype',
'from' => 0,
'size' => 500,
'body' => array(
'query' => array(
'filtered' => array(
'filter' => NULL,
'query' => array(
'query_string' => array(
'default_operator' => 'AND',
'query' => 'atm*',
'minimum_should_match' => '80%',
'default_field' => 'index'
)
)
)
)
)
);
Result is like that:
array(
'took' => 6,
'timed_out' => false,
'_shards' => array(
'total' => 5,
'successful' => 5,
'failed' => 0
),
'hits' => array(
'total' => 492,
'max_score' => 1,
'hits' => array(
0 => array(
'_index' => 'myindex',
'_type' => 'myindextype',
'_id' => 'Branch-571',
'_score' => 1,
'_source' => array(
'indexId' => 'Branch-571',
'objId' => '571',
'index' => 'atm Baki CNaxcivanski lisey Baki sheh Zig shossesi Admiral Naximov kuc 1 ',
'type' => 'Branch',
'title' => 'Bakı C.Naxçıvanski lisey'
)
),
.................................................................................................
196 => array(
'_index' => 'myindex',
'_type' => 'myindextype',
'_id' => 'Page-114',
'_score' => 1,
'_source' => array(
'indexId' => 'Page-114',
'objId' => 'Page-114',
'index' => 'atm Baki CNaxcivanski lisey Baki sheh Zig shossesi Admiral Naximov kuc 1 ',
'type' => 'Page',
'title' => 'Kreditlər'
)
)
.................................................................................................
)
)
);
I want to filter result and get results where 'type' => 'Branch' and I change query like that
array(
'index' => 'myindex',
'type' => 'myindextype',
'from' => 0,
'size' => 10,
'body' => array(
'query' => array(
'filtered' => array(
'filter' => array(
'bool' => array(
'must' => array(
'term' => array(
'type' => 'Branch'
)
)
)
),
'query' => array(
'query_string' => array(
'default_operator' => 'AND',
'query' => 'atm*',
'minimum_should_match' => '80%',
'default_field' => 'index'
)
)
)
)
)
);
But this search return nothing.
array(
'took' => 2,
'timed_out' => false,
'_shards' => array(
'total' => 5,
'successful' => 5,
'failed' => 0
),
'hits' => array(
'total' => 0,
'max_score' => NULL,
'hits' => array()
)
);
I think query is right but no idea why it didn't get any result.
Mapping is
array(
'myindex' => array(
'mappings' => array(
'myindextype' => array(
'properties' => array(
'index' => array(
'type' => 'string'
),
'indexId' => array(
'type' => 'string'
),
'objId' => array(
'type' => 'string'
),
'title' => array(
'type' => 'string'
),
'type' => array(
'type' => 'string'
)
)
)
)
)
)
I have find answer myself. The search query must be like that
POST _search
{
"query": {
"bool" : {
"must" : {
"query_string" :{
"query":"atm*",
"default_operator":"AND",
"minimum_should_match":"80%",
"default_field":"index"
}
},
"filter": {
"term": {
"type.keyword": "Branch"
}
}
}
}
}
All is working good now.

cant get data to group in find in a cakephp HABTM

I have a HABTM relationship of Students and Subjects. I simply want to display all the subjects associated with a student without repetition of student details. I dont want the student details to keep repeating in the data output. How do I get the student details as shown below to output once and then all the subjects associated with this student to output?
Group didnt work. I didnt see the answer in the docs but I am sure this is a simple task to do.
http://book.cakephp.org/2.0/en/models/retrieving-your-data.html
$this->Student->recursive = -1;
$joinoptions = array(
// $options['joins'] = array(
array('table' => 'students_subjects',
'alias' => 'StudentsSubject',
'type' => 'LEFT',
'conditions' => array(
'Student.id = StudentsSubject.student_id',
)
),
array('table' => 'subjects',
'alias' => 'Subject',
'type' => 'LEFT',
'conditions' => array(
'StudentsSubject.subject_id=Subject.id',
)
),
);
$fieldoptions = array('Student.id,Student.last_name,Student.first_name,Student.address_street,Student.address_suburb,'
. 'Subject.name,Subject.id, StudentsSubject.id, Student.first_name,Student.last_name,Student.address_lat,Student.address_long,Student.tutor_gender_preference'
);
$student=$this->Student->find('all',array(
'conditions'=> array( 'Student.id' => $student_id),
'fields'=>$fieldoptions,
'joins'=> $joinoptions,
// 'group' => 'Student.id',
'recursive' =>-1,
));
array(
(int) 0 => array(
'Student' => array(
'id' => '216',
'last_name' => 'Ncc',
'first_name' => 'Acc',
'address_street' => '8 sdsdt',
'address_suburb' => 'Hasdsdk',
'address_lat' => 'xx',
'address_long' => 'xx',
'tutor_gender_preference' => 'No Preference'
),
'Subject' => array(
'name' => 'English: Year 7 - 10',
'id' => '9'
),
'StudentsSubject' => array(
'id' => '531'
)
),
(int) 1 => array(
'Student' => array(
'id' => '216',
'last_name' => 'Ncc',
'first_name' => 'Acc',
'address_street' => '8 sdsdt',
'address_suburb' => 'Hasdsdk',
'address_lat' => 'xx',
'address_long' => 'xx',
'tutor_gender_preference' => 'No Preference'
),
'Subject' => array(
'name' => 'Maths: Year 7 - 10',
'id' => '16'
),
'StudentsSubject' => array(
'id' => '532'
)
),
(int) 2 => array(
'Student' => array(
'id' => '216',
'last_name' => 'Ncc',
'first_name' => 'Acc',
'address_street' => '8 sdsdt',
'address_suburb' => 'Hasdsdk',
'address_lat' => 'xx',
'address_long' => 'xx',
'tutor_gender_preference' => 'No Preference'
),
'Subject' => array(
'name' => 'Physics: Year 11',
'id' => '28'
),
'StudentsSubject' => array(
'id' => '583'
)
)
)

Elasticsearch range filter not working (No filter registered for)

I'm trying ta add a range filter to my search (only articles with workflow status <= 5 should appear) and getting errors
what's wrong with my range?
$searchParams = array(
'index' => $config->search->index,
'type' => 'xxxxxxxxxx',
'size' => 10,
'from' => ($page - 1) * 10,
'body' => array(
'query' => array(
'filtered' => array(
'query' => array(
'multi_match' => array(
'query' => $query,
'fields' => array('title^8', 'caption^5', 'teasertext^4', 'articletext^2') // ^x = Gewichtung des Felds
),
),
'filter' => array(
'bool' => array(
'must' => array(
'term' => array(
'deleted' => 0,
'visible' => 1
),
'range' => array(
'workflow_status' => array('lte' => '5')
)
)
)
)
)
)
),
'sort' => array('_score', '_id:desc')
here my mapping for status:
"workflow_status": {
"type": "integer",
"index": "not_analyzed"
}
What you have is not a valid Query DSL , must should take in an array.
The body should be something on these lines :
body =>
array(
'query' => array(
'filtered' => array(
'query' => array(
'multi_match' => array(
'query' => $query,
'fields' => array('title^8', 'caption^5', 'teasertext^4', 'articletext^2') // ^x = Gewichtung des Felds
),
),
'filter' => array(
'bool' => array(
'must' => array(
array(
'term' => array(
'deleted' => 0
)
),
array('term' => array(
'visible' => 1
)
),
array(
'range' => array(
'workflow_status' => array('lte' => '5')
)
)
)

eBay API Platform Notifications - I'm not receiving all the ones I want

I'm using the eBay API and am trying to receive the following notifications:
ItemSold
FixedPriceTransaction
EndOfAuction
However, the only notification I receive is 'FixedPriceTransaction'.
The code I'm using to 'set' what notifications I receive, looks like this:
$opts = array(
'ApplicationDeliveryPreferences' => array(
'ApplicationEnable' => 'Enable',
'ApplicationURL' => 'http://my.domain/ebay_notifications.php',
),
'UserDeliveryPreferenceArray' => array(
'NotificationEnable' => array(
'EventType' => 'ItemSold',
'EventEnable' => 'Enable'
),
'NotificationEnable' => array(
'EventType' => 'EndOfAuction',
'EventEnable' => 'Enable'
),
'NotificationEnable' => array(
'EventType' => 'FixedPriceTransaction',
'EventEnable' => 'Enable'
)
)
);
Any idea what I'm doing wrong?
Schoolboy error on my account.
The 'UserDeliveryPreferanceArray' array contains multiple arrays.
All of them have the same key title: 'NotificationEnable'
This means only the last one is used - the one containing the 'FixedPriceNotification' event.
To remedy this, make each 'notification event' part of an indexed array:
'NotificationEnable' => array(
1 => array(
'EventType' => 'ItemSold',
'EventEnable' => 'Enable'
),
2 => array(
'EventType' => 'EndOfAuction',
'EventEnable' => 'Enable'
),
3 => array(
'EventType' => 'FixedPriceTransaction',
'EventEnable' => 'Enable'
)
)
Happy days.
Ok, maybe i am wrong but the working code should be:
$opts = array(
'ApplicationDeliveryPreferences' => array(
'ApplicationEnable' => 'Enable',
'ApplicationURL' => 'http://my.domain/ebay_notifications.php',
),
'NotificationEnable' => array(
1 => array(
'EventType' => 'ItemSold',
'EventEnable' => 'Enable'
),
2 => array(
'EventType' => 'AskSellerQuestion',
'EventEnable' => 'Enable'
),
3 => array(
'EventType' => 'FixedPriceTransaction',
'EventEnable' => 'Enable'
)
)
);
And not as I thought:
$opts = array(
'ApplicationDeliveryPreferences' => array(
'ApplicationEnable' => 'Enable',
'ApplicationURL' => 'http://my.domain/ebay_notifications.php',
),
'UserDeliveryPreferenceArray' => array(
'NotificationEnable' => array(
1 => array(
'EventType' => 'ItemSold',
'EventEnable' => 'Enable'
),
2 => array(
'EventType' => 'EndOfAuction',
'EventEnable' => 'Enable'
),
3 => array(
'EventType' => 'FixedPriceTransaction',
'EventEnable' => 'Enable'
)
)
);
The first one seems to work well so far. The last one generates 37 errors.
Thank you anyways for your huge suggestion.

Categories