cherrie
I am using v1.18.1 and cannot replicate the staffId
issue. If I add "staffId": 1,
to my JSON payload it sets the Assignee appropriately. Not sure what's going on in your instance.
As for the duedate
issue it's due to a specific bit of code back from 1.7.x (circa 2013). To get it working you can apply the below patch:
diff --git a/include/class.ticket.php b/include/class.ticket.php
index a7573678..2e00fd59 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -4370,7 +4370,7 @@ implements RestrictedAccess, Threadable, Searchable {
$ticket->email_id = $vars['emailId'];
//Make sure the origin is staff - avoid firebug hack!
- if ($vars['duedate'] && !strcasecmp($origin,'staff'))
+ if ($vars['duedate'] && in_array(strtolower($origin), ['staff', 'api']))
$ticket->duedate = date('Y-m-d G:i',
Misc::dbtime($vars['duedate']));
diff --git a/include/api.tickets.php b/include/api.tickets.php
index d160c324..bb8f7e94 100644
--- a/include/api.tickets.php
+++ b/include/api.tickets.php
@@ -43,15 +43,22 @@ class TicketApiController extends ApiController {
foreach ($form->getFields() as $field)
$supported[] = $field->get('name');
- if(!strcasecmp($format, 'email')) {
- $supported = array_merge($supported, array('header', 'mid',
- 'emailId', 'to-email-id', 'ticketId', 'reply-to', 'reply-to-name',
- 'in-reply-to', 'references', 'thread-type', 'system_emails',
- 'mailflags' => array('bounce', 'auto-reply', 'spam', 'viral'),
- 'recipients' => array('*' => array('name', 'email', 'source'))
- ));
-
- $supported['attachments']['*'][] = 'cid';
+ switch ($format) {
+ case 'email':
+ $supported = array_merge($supported, [
+ 'header', 'mid', 'emailId', 'to-email-id', 'ticketId', 'reply-to',
+ 'reply-to-name', 'in-reply-to', 'references', 'thread-type', 'system_emails',
+ 'mailflags' => ['bounce', 'auto-reply', 'spam', 'viral'],
+ 'recipients' => ['*' => ['name', 'email', 'source']]
+ ]);
+ $supported['attachments']['*'][] = 'cid';
+ break;
+ case 'json':
+ case 'xml':
+ $supported = array_merge($supported, [
+ 'duedate', 'slaId', 'staffId'
+ ]);
+ break;
}
return $supported;
This patch also fixes the Unexpected data received in API request
errors for duedate
, slaId
, and staffId
used within JSON and XML payloads.
With this being said, I have to run this by the team to see exactly what the purpose of this bit of code was and see if we can amend it to the changes in my patch.
Disclaimer:
Since I don't yet know the true reason behind the original code you will proceed with applying the above patch at your own risk. I cannot guarantee that this won't open your system to further issues, etc.
Cheers.