Get sales info with API call.

A customer asked how they could get all sales data from Group-Office on to a television screen. I've written this little script to get this info. Group-Office has no real API (yet) but it is possible to get this data.

The client class is used to connect to Group-Office and get's the year report data which they can use to display.

Because this might be useful to others I've written this tiny blog post:


class Client {

 private $host;
 private $curl;

 public function __construct($host, $username, $password) {
  $this->curl = curl_init();

  $this->host = rtrim($host, '/');

  curl_setopt($this->curl, CURLOPT_USERPWD, $username . ":" . $password);
  curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, TRUE);

 public function request($route, array $data = array()) {

  curl_setopt($this->curl, CURLOPT_URL, $this->host . '/index.php?r=' . $route);
  curl_setopt($this->curl, CURLOPT_POST, 1);
  curl_setopt($this->curl, CURLOPT_POSTFIELDS, http_build_query($data));

  $json = curl_exec($this->curl);

  return json_decode($json);

 public function __destruct() {


$client = new Client('', 'apiuser', 'SECRET');

$data = $client->request('billing/report/yearReport', array(
  'start_date' => '01-01-2017',
  'end_date' => '31-12-2017',
  'books' => json_encode(array('2'))



  • Andrew303john
    March 14, 2020 at 10:52

    Nice blog with Amazing information .. love to read about this.
    Awaiting for your new post
    We at bring to you the most significant Case Study help writing service at the best cost. With long stretches of understanding we are prepared to give assignment help over the globe.You will be guided here with a portion of the information of Marketing assignment which could assist you in deciding writing a Marketing assignment. Nonetheless, we unequivocally prescribe you to benefit Civil Law Case Study Assignment Help from our specialist to find out about marketing and its scope.We also provide /Mathematics Assignment Help from our experts.

  • sport fans
    June 03, 2020 at 08:51

    Nice blog with Amazing information .. love to read about this.
    Awaiting for your new post
    Garrett Mitchell Jersey
    Garrett Crochet Jersey
    Daniel Cabrera Jersey

  • Nani Neeraja Srirama
    August 19, 2020 at 15:03

    WOW..!! This is really an amazing work,

  • Nani Neeraja Srirama
    August 19, 2020 at 15:04

    This comment has been removed by the author.

  • James Martin
    September 02, 2020 at 14:54

    You should opt for Assignment Help services if you want to save your time. For more details on academic writing services, you have to browse the website of the service provider and grab all information about assignment writing help in Qatar. 

Back to Top