cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor

Error in calling web service "Create meeing"

Hi, I hope you are all fine.
 
I am going to call "Create meeting" web service but I get error as following:
{"int_err_code":"InvalidToken","msg":"Invalid token passed"} 
 
I will send you my codes. Please review my code and let me know what is the problem.
 
My email: fazeli.mostafa@gmail.com
 
===========================================
 
function CallAPI($type, $url, $data = false, $headers = null)
{
   
    //Initiating web service and opening a session
    $curl = curl_init();
   
    //Web service type
    switch ($type)
    {
        case "POST":
            curl_setopt_array($curl, array(
                CURLOPT_RETURNTRANSFER => 1,
                CURLOPT_URL => $url,
                CURLOPT_POST => 1,
                CURLOPT_POSTFIELDS => $data
            ));
            break;
        case "GET":
            curl_setopt_array($curl, array(
                CURLOPT_RETURNTRANSFER => 1,
                CURLOPT_URL => $url . $data
            ));
            break;
    }
   
    //Setting header information
    if ($headers && !empty($headers)) {
        curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
    }
   
    //Seting extra information
    $timeout = 5;   
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $timeout);   

    //Executing web service
    $result = curl_exec($curl);
   
    //Closing current session
    if (curl_errno($curl)) {
        echo 'Error:' . curl_error($curl);
    }   
    curl_close($curl);
   
    //Returning result of web service
    return $result;
}

//Creating access token
$url = 'https://api.getgo.com/oauth/access_token';
$get_fields = '?grant_type=password&user_id={user_id}&password={password}&client_id={client_id}';
$headers = array('Accept' => 'application/json', 'Content-Type' => 'application/x-www-form-urlencoded');
$access_token_response = CallAPI('GET', $url, $get_fields, $headers);

$access_token_response_array = json_decode($access_token_response, true);
echo $access_token_response_array['access_token'] . '<br />';


//Creating (Scheduling) new meeting
$url = "https://api.getgo.com/G2M/rest/meetings";
$post_fields = array (
                    'subject' => 'New meeting',
                    'starttime' => '2018-07-01T15:00:00Z',
                    'endtime' => '2018-07-01T16:00:00Z',
                    'meetingtype' => 'scheduled',
                    'passwordrequired' => 0,
                    'conferencecallinfo' => 'Free',
                    'timezonekey ' => ''
                );
$headers = array(
    'Accept' => 'application/json',
    'Content-Type' => 'application/json',
    'Authorization' => $access_token_response_array['access_token']  
    );
//'Authorization' => 'Bearer ' . $access_token_response_array['access_token']  is also checked but I got the same error.

$create_meeting_response = CallAPI('POST', $url, $post_fields, $headers);
echo '<br />';
print_r($create_meeting_response);
 
 
==========================
 
 
If any one knows some information, please let me know.
Regards,
Mostafa
1 REPLY
LogMeIn Manager

Re: Error in calling web service "Create meeing"

Hi @fazelimostafa

 

Please email all API support questions to developer-support@logmein.com

 

 

Glenn is a member of the LogMeIn Community Care Team.

Was your question answered? Please mark it as an Accepted Solution.
Was a post helpful or informative? Give it a Kudo!