Introducing the Gold Lasso API API Documentation for PHP Clients The eloop API provides programmatic access to your organization s information using a simple, powerful, and secure application programming interface, the eloop Web Services API (the API). To use this document, you should have a basic familiarity with software development, Web services, and the eloop user interface. Any functionality described in this guide is available only if your organization has the API feature enabled. For accessing the API you will require an eloop4.0 username and password, and certificate from Gold Lasso. If you cannot access the features you see in this guide and would like to, please contact Gold Lasso at (301) 990-9857 or email api@goldlasso.com. 1. Install curl with SSL if not installed on your machine 2. Install nusoap and make necessary changes. 3. Create eloop.class.php. 4. Sample PHP Code. 5. Basic Calls a. Important Calls b. Calls for Managing Subscribers c. Calls for Managing Messages d. Calls for Managing Outbound List e. Calls for Managing Categories 6. Custom Objects 7. Developer Documentation
1. Please make sure curl for SSL is installed for PHP on the machine you are planning to use for development. Helpful link for curl: http://curl.haxx.se/libcurl/php/ 2. Install nusoap. Create new function call2() in nusoap.php, or change the existing call() function the way give below: Add following lines just before // serialize envelope ########## START ############## $payload = "<$operation xmlns=\"http://services.eloop.gl.com/\">"; if ( is_array($params) ) { $i = 0; foreach($params as $var=>$value) { $payload.= "<$var xmlns=\"\">$value</$var>"; $i++; else { $payload.= "<arg0 xmlns=\"\">$params</arg0>"; $payload.= "</$operation>"; ####### END #################
3. Create eloop.class.php. After changing the settings accordingly. <?php require_once('../lib/nusoap.php'); // modified for use with your parameter structure class eloop { var $lmc_namespace = 'http://services.eloop.gl.com/'; var $wsdl = '/home/apiejb.wsdl'; var $connect_timeout = 10; var $response_timeout = 20; var $client; var $soap_username = 'username'; var $soap_password = 'password'; //Constructor function eloop($pem = 'keystore.pem') { $this->client = new nusoap_client($this->wsdl, true, false, false, false, false, $this- >connect_timeout, $this->response_timeout); $this->client->setcurloption(curlopt_ssl_verifypeer, FALSE); $certrequest = array( 'sslcertfile' => $pem, 'sslkeyfile' => $pem, 'passphrase' => '' ); $this->client->setcredentials($this->soap_username, $this->soap_password, 'certificate', $certrequest);?> 4. Sample PHP Code using eloop.class.php. <?php require_once '../samples/eloop.class.php'; $eloop = new eloop('/home/certs/keystore.pem'); // Printing sayhello() function $result = $eloop->client->call('sayhello', 'Dippy', $eloop->lmc_namespace,'', false, null, 'document'); $result = $result['return']; echo $result; echo '<br><br>'; // Printing Printing Lists $result = $eloop->client->call('getlists', array(), $eloop->lmc_namespace,'', false, null, 'document'); $lists = $result['return']; echo "<div style='width:555px'>\n"; foreach($lists as $list) { $desc = str_replace("\r\n", ', ', $list['description']);
?> echo "<b>{$list['name']</b><br><font size=1>{$desc</font><br><br>\n"; echo "</div>\n"; 4. Basic Calls 1. Two important calls for using eloop API are: login() public void login(java.lang.string ausername, java.lang.string apassword) throws com.gl.eloop.util.exceptionmanagement.eloopexception This is the first function that must be called when using the API. It validates your credentials and start API session. Valid username and password must be passed in this initial function. The method for passing this are by using an existing eloop 4.0 username/password or by creating a new username/password under the account settings->account users section of eloop Parameters: ausername - User Name for eloop 4.0 system apassword - Password for eloop4.0 system Throws: com.gl.eloop.util.exceptionmanagement.eloopexception (If user/password does not match in eloop System) logout() public void logout() throws com.gl.eloop.util.exceptionmanagement.eloopexception This is the last function that should be called to end the session. Always call this function to invalidate the session. For security reasons this function must be called. Throws: com.gl.eloop.util.exceptionmanagement.eloopexception describetablenames() String describetablenames() This function can be used to get Database tables names. describetable() String describetable(string tablename) This function can be used to get description of a table runquery() Object[][] runquery(string query, int limit, int offset)
This function can be used to run a SELECT SQL query. This function can only be used to get data and cannot be used to update data. 2. Calls for Managing Subscribers: void addsubscribertocommcategory(long subscriber_id, int cat_id) This function allows you to add a subscriber to a communication category. void addsubscribertolist(long subscriber_id, long list_id) This function allows you to add a subscriber to an outbound list. long addupdatesubscriber(subscriber sub) This function adds a new subscriber that or updates an existing subscriber. void deletesubscriber(long subscriber_id) This function can be used to delete a subscriber based on a unique identifier. Subscriber getsubscriberbyid(long subscriber_id, int[] dp_ids) This function gets the Subscriber information by unique ID along with the associated datapoint value. Subscriber[] getsubscriberdata(int[] dp_ids, long start, short length) This function gives the list of subscriber data information along with the datapoint value Subscriber[] getsubscriberdatawithsort(int[] dp_ids, long start, short length, int sort_dp_id, boolean sort_asc) This function is the same as the getsubscriberdata with the addition of the ability to sort. void removesubscriberfromcommcategory(long subscriber_id, int cat_id) This function allows you to remove a subscriber from a communication category. void removesubscriberfromlist(long subscriber_id, long list_id) This function allows you to remove a subscriber from an outbound list. Subscriber[] searchsubscribersbydatapoint(datapointstatement criteria, int[] dp_ids, long start, short length, int sort_dp_id, boolean sort_asc) This function allows you to search the subscribers that meet a certain criteria within the datapoint. void setsubscriberstatus(long subscriber_id, Subscriber.SubscriberStatus status_id) This function allows you to set the status of a subscriber. int addupdatedatapointcategory(category category) This function will allow you to add or update a datapoint category. int createdatapoint(datapoint dp) This function creates a new datapoint. void deletedatapoint(int dp_id) This function deletes a datapoint based on a unique datapoint ID. Category[] getalldatapointcategories() This function will return all of the existing datapoint categories. Datapoint[] getalldatapoints() This function returns the array of all datapoint objects in your eloop account. Datapoint getdatapointbyid(int dp_id) This function returns a datapoint based on a unique ID. Datapoint[] getdatapointsbycategoryid(int cat_id) This function returns the array of all Datapoint objects under a category. void modifydatapoint(datapoint dp) This function modifies or updates a datapoint. 3. Calls for Managing Messages: long addupdatemessage(message msg)
This function allows you to add or update a message. int addupdatemessagecategory(category category) This function will allow you to add or update a message category. void deletemessagebyid(long msg_id) This function deletes a message by message ID. Category[] getallmessagecategories() This function will return all of the existing communication categories. Message getmessagebyid(long msg_id) This function returns the message by message ID. Message[] getmessages() This function gets all messages. Message[] getmessagesbycategoryid(int cat_id) This function returns the message by category ID. 4. Calls for Managing Outbound Lists: long addupdatelist(list list) This function allows you to create or update a list. int addupdatelistcategory(category category) This function will allow you to add or update a list category. void deletelistbyid(long list_id) This function will delete a list based on a list ID. Category[] getalllistcategories() This function will return all of the existing list categories. List getlistbyid(long list_id) This function allows you to returns a list based on a List ID. List[] getlists() This function will return all of the lists associated with your account. List[] getlistsbycategoryid(int cat_id) This function will return all lists under a list category by category ID. 5. Calls for Managing Categories: int addupdatecommunicationcategory(category category) This function will add or update a communication category. Category[] getallcommunicationcategories() This function will return all of the communication categories. Category[] getcategoriesbyparentid(int cat_id) This function will allow you to return all of the child categories (list, message, communication, and datapoint) under the parent categories. Category getcategorybyid(int cat_id) This function gets a single category (list, message, communication, and datapoint) by category ID. Category[] getdatapointcategoriesbyparentid(int cat_id) This function will return all of the existing datapoint categories under a parent category. 6. Custom Objects Class com.gl.eloop.bean.category Class for storing Category information
Class com.gl.eloop.bean.datapoint Datapoint class stores information about subscriber like First Name, Last Name or any specific information like DOB, Card Number etc. Class com.gl.eloop.bean.list Class Outbound list is a virtual place holder of subscribers. Class com.gl.eloop.bean.message Class Outbound Message stores the Message information like HTML Body. Class com.gl.eloop.bean.subscriber Class Subscriber contains basic information of subscriber like Status, Optin-Method etc. 7. Developer Documentation For eloop API reference and developer documentation please Click Here