How to put date_start parameters via REST got error Did not recognize date_start

Hi all,

I created Calls via REST v10 I copy format of start_date from database.

but always return error message.

stdClass Object
(
  [error] => invalid_parameter
  [error_message] => Did not recognize date_start as a date/time, it looked like 2016-05-19 12:45:00
)

My code is below:

$seconds = time();
$_seconds = ceil($seconds / (15 * 60)) * (15 * 60);
$date_start = date('Y-m-d H:i:00', $_seconds);
$url = $base_url . "/Calls/";
$record_arguments = array(
    "name" => "Test from local",
    "description" => "Description from local",
    "parent_id" => "<id>",
    "date_start" => $date_start,
    "status" => "<status>",
     ...
);

How do I put time in date_start or any date?

Sugar 7.6 Ent

Thanks,

May

Parents Reply
  • Hi Autchara,

    SugarCRM uses ISO 8601 standart for API calls.   PHP.net has a predefined format for this. PHP: date - Manual

    You would use format 'c' in order to get ISO 8601 formated times which API excepts them.

    So here is the parameters for logging a call for 30 minutes from NOW;

    $date_start = date('c');
    
    
    $params = array(  
        "name" => "Test from local",  
        "description" => "Description from local",  
        "date_start" => $date_start,
        "duration_minutes" => 30
    ); 
    
    
    

    Hope this helps.

    Best Regards

    Tevfik Tümer

    Developer Support Engineer

Children