Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

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

tomm15769932
Level 2
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
mikecyang
Correct answer by
Employee
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
mikecyang
Correct answer by
Employee
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

tomm15769932
Level 2
Level 2

thank you very much.

this solves the issue.