Wednesday, May 13, 2015

Connect your website to Group-Office

Often it's desired to connect a website to Group-Office. For example you might want to have a sign up form that adds a contact to Group-Office.
Group-Office has a powerful JSON API to do this. Here's an example script that add's a contact using cURL. With cURL you can do HTTP requests in your own PHP script that you can run on your own CMS like Wordpress or Drupal for example.



<?php
//URL to Group-Office. You must use SSL because we use basic auth!
$groupoffice_url = "https://localhost/groupoffice-6.1/www/";

//Group-Office username and password. You should create a restricted user that 
//can only add contacts to this addressbook.
$username = 'website';
$password = 'secret';

//The contact properties to POST
$post = array(
  'addressbook_id' => 1, //required
  'company_id' => 0,
  'first_name' => 'Curl',
  'last_name' => 'Tester',
  'initials' => '',
  'title' => '',
  'suffix' => '',
  'sex' => 'M', // or 'F"
  'birthday' => '', //local format
   'email' => '',
  'email2' => '',
  'email3' => '',
  'department' => '',
  'function' => '',
  'home_phone' => '',
  'work_phone' => '',
  'fax' => '',
  'work_fax' => '',
  'cellular' => '',
  'cellular2' => '',
  'homepage' => '',
  'country' => 'NL', //2 character ISO code 
  'state' => '',
  'city' => '',
  'zip' => '',
  'address' => '',
  'address_no' => '',
  'comment' => ''
);

$process = curl_init($groupoffice_url . '?r=addressbook/contact/submit');
curl_setopt($process, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($process, CURLOPT_POST, 1);
curl_setopt($process, CURLOPT_POSTFIELDS, $post);
curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);

$return = curl_exec($process);
curl_close($process);

//JSON decode the response
$json = json_decode($return, true);


//Handle success or error here.
if ($json['success']) {
 echo "Contact saved!\n";
} else {
 echo "Failed to save contact: " . $json['feedback'] . "\n";
}

12 comments:

  1. Hello,

    That's really not necessary because you can reach the login page from a connection to the World Wide Web. The issue I'm sure which brought this up is "branding." When end-users login into G-O (Intermesh) they should see logos of their own company or employer, not G-O (Intermesh). For instance, if my company is IBM and we used G-O (Intermesh), certainly my employees and officers should see an IBM logo before, during and exiting G-O (Intermesh). ERP solution builders often have this setting as a required default branding. The only party seeing a G-O (Intermesh) logo should be G-O (Intermesh).

    --- MMS

    ReplyDelete
  2. Mario, this blog post has nothing to do with what you are talking about. The code simply allows you to create customers when a new user signs up or certain information is entered through any other public website. No login is done.

    But I would agree with you, from a developers perspective the "G-O (Intermesh)" is so engraved, that it is too much work to even change it on the code. Not just the logo, but even the name from certain places. Its nearly impossible. The code is so well encrypted and even the open one its impossible to figure out, I feel like its all obfuscated. Changing the logo is very easy, this thing has Intermesh written on GOTA and everywhere. So going back to your point, you are showing your employees we are using Group Office, how cool is it... Lets face it, only small businesses or up to so many (100) users can efficiently work into this thing, having some support+developer on site. Cool, now i know how Group Office works Boss, ima go open my own company.

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. Thanks for your sharing. Hope you can contribute more quality posts to this page. Thank you!
    despacito lyrics , color switch

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. Thanks at your dicusion and your post shearing. for me was very interesting
    Bully Anniversary Edition apk

    ReplyDelete
  7. Model Paper
    Previous Papers Download
    Subject wise 10th Board Model Paper
    Please check the Concerned Board Official Site to find the 10th Board Exam Sample Papers. To find Subject-Wise All Board 10th Model Question Paper PDF Links.
    Every Subject 12th Board Exam Question Paper PDF Links are updated in this section.
    www.modelpapers2021.com

    ReplyDelete
  8. primevideo.com/mytv - you can add it to your favorite smart device and for sign in enter amazon prime video activation code at www.amazon.com/mytv login page.

    ReplyDelete
  9. With kinky twists that you can do at home, you are going to want Marley hair, braiding hair or crochet kinky twist hair extensions, hair gel, a brush along with a rat tail comb. You are going to really need to commence by detangling your hair, both with the palms or your brush. After your hair is detangled, you’ll commence parting your hair into smaller sections- https://ideasoffashion.com/kinky-twist-hairstyles/

    ReplyDelete
  10. When I showed you around Centennial Park reno private investigator

    ReplyDelete