This manual is deprecated. Please visit https://groupoffice.readthedocs.io for the latest documentation.

API calls

From Group-Office Groupware and CRM Documentation
Revision as of 14:35, 27 August 2013 by Admin (Talk | contribs) (Logging in)

Jump to: navigation, search

Logging in

Here's some sample code on how to login to Group-Office with the CURL based HTTP client and get notes from the demo.


<?php

//Adjust this path to suit your needs
require('/usr/share/groupoffice/GO.php');

//not required but can be used to get CLI input params
$params = GO_Base_Util_Cli::parseArgs();

$host = 'http://demo.group-office.eu/';

//Login
$httpClient = new GO_Base_Util_HttpClient();
$success = $httpClient->groupofficeLogin($host, 'demo','demo');

if(!$success)
        throw new Exception("Could not login to Group-Office");

//Get notes
$response = $httpClient->request($host,array(
                'r'=>'notes/note/store',
      'start'=>0,
      'limit'=>10

));

$result = json_decode($response);
//print names
foreach($result->results as $record){
   echo $record->name."<br>\n";
}