The sample usage of neucrm is listed here for your ready referance and quick interagation of neucrm with your existing application.
The below sample code is for PHP language.
<?php /* Configuration */ $BASE_URL = 'http://crm.mydomain.com:8080/crm'; $API_KEY = '6a920e48246c920da00f6dcba018d9b25b087539b0d550cd29'; $USERID = 6; function api_request($url, $params){ $curl = curl_init($url); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($params)); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); $response = json_decode(curl_exec($curl), true); $curl_error = curl_error($curl); curl_close($curl); if( $curl_error) exit('curl error: '.$curl_error); return $response; } /* Example 1: Do test call */ $response = api_request($BASE_URL.'/api/server/test'); print_r($response); /* Example 2: Get software version */ $response = api_request($BASE_URL.'/api/server/version'); print_r($response); /* Example 3: Get one Customer by Mobile Number */ $response = api_request($BASE_URL.'/api/customer/list', array( 'api_key' => $API_KEY, 'userid' => $USERID, 'mobile' => 1234567890, ) ); if( $response['error']) exit('Customer API Error: '.$response['error']); $customers = $response['result']; $customer = $customers[0]; //first customer print_r($customer); /* Example 4: Get all Service(s) of the above customer */ $response = api_request($BASE_URL.'/api/service/list', array( 'api_key' => $API_KEY, 'userid' => $USERID, 'customerid' => $customer['id'], ) ); if( $response['error']) exit('Service API Error: '.$response['error']); $services = $response['result']; print_r($services); /* Example 5: Select any service for payment. I am selecting one service which is having Status=NP or NPD */ $serviceid = 0; // initalize variable foreach($services as $k=>$v){ if( $v['status']=='NP' OR $v['status']=='NPD'){ $serviceid = $v['id']; break; } } /* if none of the service was in NP or NPD, select first service for payment */ if( !$serviceid) $serviceid = $services[0]['id']; print_r($serviceid); /* Example 6: make payment */ $response = api_request($BASE_URL.'/api/payment/new', array( 'api_key' => $API_KEY, 'userid' => $USERID, 'serviceid' => $serviceid, 'amt' => 100, 'mode' => 'Online', 'ref' => 'credit card xxx0676 or wallet', ) ); /* Note: If that service was in NP or NPD, it will be automatcally reconnected and moved to ACTIVE status. No need to reconnect manually */ if( $response['error']) exit('Payment API Error: '.$response['error']); $paymentid = $response['result']; print_r($paymentid); /* Example 7: For other actions like suspend/restore */ $response = api_request($BASE_URL.'/api/service/action', array( 'api_key' => $API_KEY, 'userid' => $USERID, 'serviceid' => $serviceid, 'action' => 'renew', ) ); if( $response['error']) exit('Service Action API Error: '.$response['error']); $action_result = $response['result']; // expected `done`; if( $action_result =='done'){ // Do some thing on success response }else{ // Do some thing on error response } print_r($action_result); /* Example 8: Plan change */ $response = api_request($BASE_URL.'/api/service/planchange', array( 'api_key' => $API_KEY, 'userid' => $USERID, 'serviceid' => $serviceid, 'planid' => 50, 'subplanid' => 63, 'schedule' => 'immediately', ) ); if( $response['error']) exit('Plan change API Error: '.$response['error']); $planchange_result = $response['result']; // expected result `done`; print_r($planchange_result); /* Example 9: Get Status wise count */ $response = api_request($BASE_URL.'/api/service/status_count', array( 'api_key' => $API_KEY, 'userid' => $USERID, ) ); if( $response['error']) exit('Service API Error: '.$response['error']); $status_count = $response['result']; print_r($status_count); /* Ecample 10: Get Service list in the order of latest expiry date : simple api call */ $response = api_request($BASE_URL.'/api/service/list', array( 'api_key' => $API_KEY, 'userid' => $USERID, 'sort_field' => 'valid_upto', 'sort_order' => 'asc', ) ); $service_list = $response['result']; print_r($service_list); /* Example 11: Get Service list in the order of latest expiry date : with pagination */ /* If the result contains greater than 100 records, use Pagination feature, otherwise you may use above simple API call */ $service_list = array(); $page = 1; $records_per_page = 50; /* You can use this value to get upto 100 records per page. Here we are showing here, to get 50 records per call */ while( $page * $records_per_page <= $status_count['Total']) { $offset = ($page-1) * $records_per_page; $response = api_request($BASE_URL.'/api/service/list', array( 'api_key' => $API_KEY, 'userid' => $USERID, 'rows_limit' => $records_per_page, 'rows_offset' => $offset, 'sort_field' => 'valid_upto', 'sort_order' => 'asc', ) ); $service_list = array_merge($service_list,$response['result']); $page++; } print_r($service_list); /* End of API Examples. Thank you. */ ?>