adding an entity to a collection fails with dps2015 services php api

tomm15769932

22-12-2015

hello,

we habe some problems with the php-api.

trying to add an article-entity to a collection ( or a collection to the home-collection ) will always fail with the message:

'content-json {"code":"JsonMappingException","message":"JsonMappingException"}'

the message is thrown within the method dps2015sdk\contentService\Article()->updateContentElements();

it seems that the concatenated data ( $arrData ) will not meet the requested data-schema in the server-request.

$articleObj = new dps2015sdk\contentService\Article($oDpsUser);  ok

$articleObj->setEntityName("xyz");  ok

$articleObj->requestMetadata();  ok

$collObj->addEntity($articleObj);  ok

$collObj->requestMetadata();  ok

$collObj->requestContentElements(); ok

$collObj->updateContentElements();  fails

thanks

tom

Accepted Solutions (1)

Accepted Solutions (1)

mikecyang

Employee

22-12-2015

Hi,

dps2015sdk\contentService\Collection::addEntity() requires an entity HREF, please try replacing your line #4 with the following:

$collObj->addEntity($articleObj->getHref());

Please let me know if this doesn't solve the issue.

Best,

Mike