mercredi 22 avril 2015

API Office 365 create an event in user calendar format error

I am using Office 365 to post an event in user calendar. I have a problem with the format of my post.

Here is my code (using Codeigniter and Rest lib) :

    $config = array (
        'server'            => 'http://ift.tt/1GRCqe5', 
        'http_user'         => 'mail@domain.com',
        'http_pass'         => 'mypassword',
        'http_auth'         => 'basic',
    );
    $this->load->library('rest', $config);

    $event = array(
        'Subject' => 'Try to post :(',
        'Body'    => array(
            'ContentType' => 'HTML',
            'Content'     => 'Not really concluant...'),
         'Start'    => "2015-04-22T18:00:00Z",   
         'End'      => "2015-04-22T19:00:00Z",   
         'StartTimeZone'    => 'Europe Standard Time',
         'EndTimeZone'  =>  'Europe Standard Time',
    );

    var_dump($this->rest->post('events', json_encode($event), 'json'));

And here is the response :

A supported MIME type could not be found that matches the content type of the response. None of the supported type(s) 'application/json;odata.metadata=minimal

What I am doing wrong ? Don't say all please !

Aucun commentaire:

Enregistrer un commentaire