AnsweredAssumed Answered

API v10: Fields date_sent and assigned_user_id ignored when POST /Mail/archive

Question asked by Robin Thomas on Sep 28, 2015
Latest reply on Sep 28, 2015 by dkallish
I am trying to archive E-Mails through the REST API v10 on Sugar Professional 7.6.1.0. I make a post to /Mail/archive passing the following fields:
array(
    'date_sent' => $email->date->format('Y-m-d\TH:i:s'),
    'from_address' => $email->from->email,
    'to_addresses' => $email->to,
    'cc_addresses' => $email->cc,
    'bcc_addresses' => $email->bcc,
    'subject' => $email->subject,
    'html_body' => $email->htmlBody,
    'text_body' => $email->textBody,
    'status' => 'archive',
    'teams' => array(
        'primary' => $perms['default_team'],
    ),
    'attachments' => $attachments,
    'assigned_user_id' => $perms['user_id'],
)
The E-Mail is imported correctly including the attachments, team and fields, excepting assigned_user_id, which is set to the user who imports it (apiuser in this case), and date_sent which is set to the current date and time.

I know the assigned_user_id is a valid user id, but he just seems to ignore it.

I tried a few different formats for the date_sent: 'Y-m-d H:i:s' (works with 4.1), 'Y-m-d\TH:i', 'd.m.Y H:i:s' (apiuser's datetime format as set in the user preferences). All of these cause the server to return an empty response. If I use 'Y-m-d\TH:i:s' the e-mail is imported correctly but the date_sent is overwritten with the current date and time.

Any ideas? Thanks in advance.

Outcomes