Custom API Sample File

<?php

/*****LOGIN USER*****/
$parameters = array('api_uId'=>"your_api_uId",'api_key'=>"your_api_key",'Method'=>'LoginUser');

/*****FETCH USER GROUPS*****/
$parameters = array('api_uId'=>"your_api_uId",'api_key'=>"your_api_key",'Method'=>'FetchAllGroups');

/*****ADD USER GROUP*****/
$parameters = array('api_uId'=>"your_api_uId",'api_key'=>"your_api_key",'GroupTitle'=>"Sample Test Group",'Method'=>'AddGroup');

/*****UPDATE USER GROUP*****/
$parameters = array('api_uId'=>"your_api_uId",'api_key'=>"your_api_key",'UpdateGroupTitle'=>"Sample Test Group New",'GroupId'=>"1",'Method'=>'UpdateGroup');

/*****DELETE GROUP AND ALL LEADS OF GROUP*****/
$parameters = array('api_uId'=>"your_api_uId",'api_key'=>"your_api_key",'GroupId'=>"1",'Method'=>'DeleteGroup');

/*****ADD CUSTOM FIELD*****/
$parameters = array('api_uId'=>"your_api_uId",'api_key'=>"your_api_key", 'FieldName'=>'Gender','FieldType'=>'radio','FieldOptions'=>array("Male","Female"),'Method'=>'AddcustomField');

/*****UPDATE CUSTOM FIELD*****/
$parameters = array('api_uId'=>"your_api_uId",'api_key'=>"your_api_key ",'PreviousFieldName'=>' Gender ','newFieldName'=>' Subject ','newFieldType'=>'select','FieldOptions'=>array("1","2","3"),'Method'=>'UpdateCustomField');

/*****CHECK CUSTOM FIELD*****/
$parameters = array('api_uId'=>"your_api_uId",'api_key'=>"your_api_key",'FieldName'=>'Gender','Method'=>'CheckCustomField');

/*****DELETE CUSTOM FIELD*****/
$parameters = array('api_uId'=>"your_api_uId",'api_key'=>"your_api_key",'FieldName'=>'Age','Method'=>'DeleteCustomField');

/*****SEARCH LEAD (search by leadId,first_name,last_name,email,phone,mobile etc)*****/
$parameters = array('api_uId'=>"your_api_uId",'api_key'=>"your_api_key",'GroupId'=>'5465','searchField'=>'first_name','searchText'=>'HP','sortBy'=>'ASC','Method'=>'SearchByUserInput');

/*****UNSUBSCRIBE Lead/Contact BY leadId or email or phone or mobile*****/
$parameters=array('api_uId'=>"your_api_uId",'api_key'=>"your_api_key",'unsubscribeBy'=>'leadId','unsubscribeValue'=>'6016','Method'=>'Un_SubscribeLead');

/*****UPDATE EXISITING Lead  fields ,*****/
/*For Update default Fields value Please use below fields: Allow Fields: first_name, last_name, email, mobile, phone, city, state, zip, address, company , website, additional_Info*/
$parameters = array('api_uId'=>"your_api_uId",'api_key'=>"your_api_key",'LeadField'=>'first_name','LeadData'=>'Support','LeadId'=>'5976','Method'=>'UpdateExistingLead');

/*****MOVE LEAD*****/
$parameters = array('api_uId'=>"your_api_uId",'api_key'=>"your_api_key",'moveGroupId'=>'5787','LeadId'=>'5964','Method'=>'MoveLead');

/*****COPY LEAD*****/
$parameters = array('api_uId'=>"your_api_uId",'api_key'=>"your_api_key",'copyGroupId'=>'5787','LeadId'=>'5964','Method'=>'CopyLead');

/*****Add Signle Lead*****/
$parameters = array('api_uId'=>"your_api_uId",'api_key'=>"your_api_key",'groupId'=>"5787","first_name"=>"Support", "last_name"=>"Team", "email"=>"leadname1@xyz.com", "phone"=>"3465656235", "mobile"=>"3465656235", "country_code"=>"+1", "website"=>"http://www.google.com","company"=>"xyz ",  "zip"=>"35000","address"=>"xyz","Sample Custom Field"=>"Sample Value",'Method'=>'AddSingleLead');

/*****Add Multiple Leads*****/
$parameters = array('api_uId'=>"your_api_uId",'api_key'=>"your_api_key",'groupId'=>"5656",'leads_array'=>array(array("first_name"=>"Support", "last_name"=>"team", "email"=>"support1@xyz.com", "phone"=>"3465656111", "mobile"=>"3465656111", "country_code"=>"+1", "website"=>" http://www.google.com ","company"=>"Courtyard by Marriott New York Manhattan/Times Square South",  "zip"=>"35000","address"=>"152 W 10th St New York NY","NUMan"=>"HP"),array("first_name"=>"Support2", "last_name"=>"team", "email"=>"support1@xyz.com", "phone"=>"3465656222", "mobile"=>"3465656222", "country_code"=>"+1", "website"=>" http://www.google.com ","company"=>"Xyz",  "zip"=>"35000","address"=>"xyz","Sample Custom Field"=>"Sample Value")),'Method'=>'AddMultipleLeads');

/*******Fetch Lead Fields Name**********/
$parameters = array('api_uId'=>"your_api_uId",'api_key'=>"your_api_key",'Method'=>'FetchLeadFieldsName');
/*******Add Member User**********/
$parameters = array('api_uId'=>"your_api_uId",'api_key'=>"your_api_key",'Method'=>'addMemberUser','first_name'=>'Support','last_name'=>'team','email'=>'support1@gmail.com','inbound_phone'=>'14087777111','password'=>'MmIBK-c_jrm3','permissions'=>'1');

/*******Edit Member User**********/
$parameters = array('api_uId'=>"your_api_uId",'api_key'=>"your_api_key",'Method'=>'editMemberUser','memberId'=>'1','first_name'=>'Support','last_name'=>'team','email'=>'support1@xyz.com','inbound_phone'=>'14087777111','password'=>'MmIBK-c_jrm3','member_status'=>'Active');

/*******Delete Member User**********/
$parameters = array('api_uId'=>"your_api_uId",'api_key'=>"your_api_key",'Method'=>'deleteMemberUser','memberId'=>'1');

/*******Check Member Limit**********/
$parameters = array('api_uId'=>"your_api_uId",'api_key'=>"your_api_key",'Method'=>'checkMemberLimit');

/*******Get All Members**********/
$parameters = array('api_uId'=>"your_api_uId",'api_key'=>"your_api_key",'Method'=>'getMemberUsers');
/*****From  above all fields array user can use one array at a time to perform related action*****/
$params_str=json_encode($parameters);
$ch = curl_init();
$url = 'https://theclaycode.com/glu/custom_api';
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($params_str));
curl_setopt($ch,CURLOPT_POSTFIELDS, array("Data"=>$params_str));
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
?>