From 31ac700a15458e8f14463ae697ecebbea33345ed Mon Sep 17 00:00:00 2001 From: iglocska Date: Thu, 4 Apr 2019 10:35:53 +0200 Subject: [PATCH] fix: [API] Correctly embed attributes and the event metadata in the object via /objects/view/[ID] --- app/Controller/ObjectsController.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/Controller/ObjectsController.php b/app/Controller/ObjectsController.php index 0c3576692..a93822234 100644 --- a/app/Controller/ObjectsController.php +++ b/app/Controller/ObjectsController.php @@ -612,7 +612,14 @@ class ObjectsController extends AppController if ($this->_isRest()) { $objects = $this->MispObject->fetchObjects($this->Auth->user(), array('conditions' => array('Object.id' => $id))); if (!empty($objects)) { - return $this->RestResponse->viewData($objects[0], $this->response->type()); + $object = $objects[0]; + if (!empty($object['Event'])) { + $object['Object']['Event'] = $object['Event']; + } + if (!empty($object['Attribute'])) { + $object['Object']['Attribute'] = $object['Attribute']; + } + return $this->RestResponse->viewData(array('Object' => $object['Object']), $this->response->type()); } } }