/** * Add note to ticket, ticket model is expected to be set on Note model * @param Note $note * @return Note * @throws \RuntimeException */ public function addNoteToTicket(Note $note) { $url = sprintf('/helpdesk/tickets/%d/conversations/note.json', $note->getTicket()->getDisplayId()); $response = json_decode($this->restCall($url, self::METHOD_POST, $note->toJsonData())); if (!property_exists($response, 'note')) { throw new RuntimeException(sprintf('Failed to add note: %s', json_encode($response))); } //todo set properties on Note instance return $note->setAll($response); }