FLX
FLX

Reputation: 4714

How to grab tasks from Google Tasks API for Google Apps Domains?

I made the following code that works with the Google Tasks API but it only shows result when its from gmail.com. Any custom Google Apps domain it doesn't work for. Does anyone know the url I should use for the Google Apps Domain Tasks API?

Code:

<?php
session_start();

//load libs
require_once "include/google-api-php-client/src/apiClient.php";
require_once "include/google-api-php-client/src/contrib/apiTasksService.php";

//load api
$apiClient = new apiClient();
$service = new apiTasksService($apiClient);

//authenticate
if (isset($_SESSION['oauth_access_token'])) {
  $apiClient->setAccessToken($_SESSION['oauth_access_token']);
} else {
  $token = $apiClient->authenticate();
  $_SESSION['oauth_access_token'] = $token;
}

//get token
//echo "token: ".$_SESSION['oauth_access_token']."<br />";

//get list
$taskLists = $service->listTasklists();

foreach ($taskLists['items'] as $taskList) {
  echo $taskList['title'] . " - " . $taskList['id'] . "<br />";
}


//get list items
echo "<ul>";
$tasks = $service->listTasks('@default');

foreach($tasks['items'] as $task) {
    $title = $task['title'];
    echo "<li>$title</li>";
}
echo "</ul>&#9644;&#9644;&#9644;";



?>

Upvotes: 0

Views: 1322

Answers (2)

jbills
jbills

Reputation: 694

I am using gafyd and it works for me. Has your domain migrated to the new system yet?

Upvotes: 0

Related Questions