adding an entity to a collection fails with dps2015 services php api | Community
Skip to main content
tomm15769932
New Participant
December 22, 2015
Solved

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

  • December 22, 2015
  • 2 replies
  • 1534 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by mikecyang

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

2 replies

tomm15769932
New Participant
December 23, 2015

thank you very much.

this solves the issue.

mikecyang
mikecyangAccepted solution
Employee
December 22, 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