Expand my Community achievements bar.

SOLVED

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

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Employee

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

View solution in original post

2 Replies

Avatar

Correct answer by
Employee

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

Avatar

Level 2

thank you very much.

this solves the issue.