Difference between revisions of "NATS4 API Search Member Info"
(Created page with "{{NATS4 Manual | show_api_admin_section = true }} NATS4 supports an API function to search on various parameters to obtain a list of matching members. search_member_in...") |
|||
Line 44: | Line 44: | ||
• programid (the program ID associated with the member)<BR> | • programid (the program ID associated with the member)<BR> | ||
• period (Possible values: 0 => This Period, 1 => Last Period, 2 => Today, 3 => Yesterday, 4 => This Week, 5 => This Month, 6 => This Year, 7 => All Time, 8 => Free Form *) //?? BOOLEAN, pertains only to female members ??<BR> | • period (Possible values: 0 => This Period, 1 => Last Period, 2 => Today, 3 => Yesterday, 4 => This Week, 5 => This Month, 6 => This Year, 7 => All Time, 8 => Free Form *) //?? BOOLEAN, pertains only to female members ??<BR> | ||
− | • start_time ( | + | • start_time (member's stamp field greater than specified date)<BR> |
− | • end_time ( | + | • end_time (member's stamp field less than specified date)<BR> |
• count (the maximum number of matches to return, i.e. SQL LIMIT clause) //BOOLEAN, if the member is a Count or not, e.g. Dracula<BR> | • count (the maximum number of matches to return, i.e. SQL LIMIT clause) //BOOLEAN, if the member is a Count or not, e.g. Dracula<BR> | ||
• orderby (if set, the SQL clause to order the results by. This would ordinarily be the name of a field in either the member, member_info, member_subscription, or identifier tables, and perhaps followed by DESC if the order is to be descending. If this is left empty, the results will be sorted first by member.stamp descending, then by member ID ascending.) | • orderby (if set, the SQL clause to order the results by. This would ordinarily be the name of a field in either the member, member_info, member_subscription, or identifier tables, and perhaps followed by DESC if the order is to be descending. If this is left empty, the results will be sorted first by member.stamp descending, then by member ID ascending.) |
Revision as of 07:19, 17 February 2017
NATS4 supports an API function to search on various parameters to obtain a list of matching members.
search_member_info accepts any combination of the following 41 possible input parameters:
• username (the member's username)
• memberid (the member's ID in NATS)
• email (the member's email)
• password (the member's password)
• status (the member's status)
• firstname (the member's firstname)
• loginip (the member's login IP address)
• marked (TRUE or FALSE, the member's "flagged" setting)
• lastname (the member's lastname)
• address1 (the member's street address, first line)
• address2 (the member's street address, second line)
• zip (the member's zipcode)
• city (the member's city)
• state (the member's state)
• country (the member's 2-character country code)
• mailok (TRUE or FALSE, the member's setting if it is ok to send email)
• custom1 (the member's custom1 field)
• custom2 (the member's custom2 field)
• custom3 (the member's custom3 field)
• custom4 (the member's custom4 field)
• custom5 (the member's custom5 field)
• subscription (the member's subscription ID)
• billerid (the biller's ID in NATS)
• cascadeid (the cascade ID in NATS)
• biller_transid (the biller's transaction ID)
• ip (the member's IP address that they joined with)
• trans_type_id (the transaction type ID in NATS)
• nats_transaction_id (the NATS transaction ID)
• siteid (the site ID in NATS)
• tourid (the tour ID in NATS)
• optionid (the join option ID in NATS)
• affiliate (the affiliate's username associated with the member)
• loginid (the affiliate's loginid associated with the member)
• natscode (the NATS code associated with the member)
• programid (the program ID associated with the member)
• period (Possible values: 0 => This Period, 1 => Last Period, 2 => Today, 3 => Yesterday, 4 => This Week, 5 => This Month, 6 => This Year, 7 => All Time, 8 => Free Form *) //?? BOOLEAN, pertains only to female members ??
• start_time (member's stamp field greater than specified date)
• end_time (member's stamp field less than specified date)
• count (the maximum number of matches to return, i.e. SQL LIMIT clause) //BOOLEAN, if the member is a Count or not, e.g. Dracula
• orderby (if set, the SQL clause to order the results by. This would ordinarily be the name of a field in either the member, member_info, member_subscription, or identifier tables, and perhaps followed by DESC if the order is to be descending. If this is left empty, the results will be sorted first by member.stamp descending, then by member ID ascending.)
//• statid // reserved for future use
//• subid1 //reserved for future use, subid1 is obtained only from natscode field
//• subid2 //reserved for future use, subid2 is obtained only from natscode field
*Additional possible values for "period"
9 => N/A
10 => last_week
11 => last_month
12 => past 60 days
13 => past 90 days
14 => last year
15 => past 7 days
16 => past 180 days
17 => past 30 days
18 => 2 periods ago
19 => two_days ago
20 => two_weeks ago
21 => two_months ago
22 => period 60 to 120 days ago
23 => period 90 to 180 days ago
24 => past 2 years
25 => period 7 to 14 days ago
26 => period 180 to 360 days ago
27 => period 30 to 60 days ago
28 => past 15 days
29 => period 15 to 30 days ago
30 => same date range as current period, but 1 year ago
31 => same date range as last period, but 1 year ago
32 => same date range is current period, but 1 month ago
33 => same date range is last period, but 1 month ago
34 => N/A ??
The more input parameters that are specified, the more refined your search results will be. See the examples below:
NuSOAP Example 1
This example continues from the main article NuSOAP Example:
To give a complete example of this, this is how to call it:
<?php require_once('nusoap/lib/nusoap.php'); $url = 'http://nats.site.com/admin_api.php'; // change to be the domain of your NATS install $username = 'NATSADMIN'; // your admin username $apikey = '3385e1b470b0864e27a9b648da6c0692'; // your api key $client = new nusoap_client($url.'?wsdl', true); $client->setCredentials($username,$apikey); // Check for an error $err = $client->getError(); if ($err) { // Display the error echo 'Constructor error' . $err . "\n"; exit; // At this point, you know the call that follows will fail } $values = array( 'state' => 'NJ', //matching all members who have a state = NJ 'orderby' => 'username ASC' //sort the matching results by username in ascending order ); $result = $client->call('search_member_info', $values, 'natsapiadmin_wsdl'); //for purposes of displaying the output echo '<PRE>'; print_r($result); echo '</PRE>'; ?>
NuSOAP Example 1 output
The output will be a dump of members matching state = NJ, sorted by username in ascending order, and will contain all of the corresponding fields (which could be input into a spreadsheet program):
"memberid","identid","loginid","networkid","refurl_lookup_id","status","trial","joined","expired","last_login","stamp","siteid","username","password","cryptpass","ip","email","session","mailok","flat_price","first_login","third_party_partner_id","cascadeid","cascade_item_id","token","original_username","renamed","marked","token_hash","max_password_display_time","firstname","lastname","address1","address2","zip","city","country","state","shipping_firstname","shipping_lastname","shipping_address1","shipping_address2","shipping_zip","shipping_city","shipping_country","shipping_state","phone","xsell_success","xsell_message","custom1","custom2","custom3","custom4","custom5","last_modified","member_subscription_id","memberidx","billerid","statid","cost","cost_charge","spent","refunded","charges","next_rebill","optionid","rebills","active","upgradeid","expires","nats_expires","biller_expires","original_optionid","created_date","loginid_faceigned","identid_faceigned","gateway_token","passthrough1","passthrough2","passthrough3","passthrough4","passthrough5","forced_optionid","defaulted_optionid","campaignid","programid","tourid","adtoolid","subid1","subid2","countryid","promotionalid","loginid_nice" "71","29","8","0","1","1","1","1437600472","0","0","1437600472","2","AnotherTest","friendly","b5/bQiYLz71Mg","168430114","lov@off.com","99d012a07e4ed780bbe73478b845edb1","1","0","0","0","2","3","0","AnotherTest","0","0","c1a7159241d86828971680a6c3c183e3","0","pully","Rizzo","456 Nile Dr.","","08723","Brick","US","NJ","","","","","","","","","","0","","","","","","","0","102","NETBILLING:112468846446","3","855b00a8fcc789","0","0","400","0","1","1437859672","1","0","1","","1437859672","1437859672","0","1","1437600399","0","0","112468830063","","","","","","0","0","0","2","4","0","0","0","0","0","TestVerify" "70","29","8","0","1","1","1","1437599981","0","0","1437599981","2","BrotherTest","5555555","0bU0rln36N/yY","168430114","fri@day.com","99d012a07e4ed780bbe73478b845edb1","1","0","0","0","2","3","0","BrotherTest","0","0","d47ac11ce88e7cf0baebe7dd5f1c0381","0","Joe","Smoe","123 Anywhere Rd","","07764","Deal","US","NJ","","","","","","","","","","0","","","","","","","0","101","NETBILLING:112385275771","3","855b008ca29b26","0","0","400","0","1","1437859181","1","0","1","","1437859181","1437859181","0","1","1437599946","0","0","112385275770","","","","","","0","0","0","2","4","0","0","0","0","0","TestVerify" "69","26","0","0","1","1","1","1437520286","0","0","1437520286","2","faceblock","lover","52.TcUF7LU36k","168430114","ee2e@wwere.com","f43a69e5d12af5af257a5cdfe664858d","0","0","0","0","2","3","0","faceblock","0","0","d804c9c6669f6eaaf9fd53b892dde6d3","0","Hans","Franz","123 Oak St.","","07746","Freehold","US","NJ","","","","","","","","","","0","","","","","","","0","100","NETBILLING:112468506130","3","855aed171c4f8c","0","0","400","0","1","1437779486","1","0","1","","1437779486","1437779486","0","1","1437520241","0","0","112468456983","","","","","","0","0","0","0","1","0","0","0","0","0","Type-In" "65","26","0","0","1","1","1","1437447042","0","0","1437447042","2","JerryAgain","22323232","78vav3mMEkuwI","168430114","rerefr@sede.com","a92915c14152920268ecc1667b97824e","1","0","0","0","2","3","0","JerryAgain","0","0","5c5509b4c2176fb48ccbff844ad02fe6","0","Goose","Cooked","232 Lincoln St","","07723","Holmy","US","NJ","","","","","","","","","","0","","","","","","","0","96","NETBILLING:112386847437","3","855adb3455a3ee","0","0","400","0","1","1437706242","1","0","1","","1437706242","1437706242","0","1","1437446981","0","0","112386847436","","","","","","0","0","0","0","1","0","0","0","0","0","Type-In" "64","29","8","0","1","1","1","1437445867","0","0","1437445867","2","LotsOfFun","andmetoo","628Ea/L1HBQbs","168430114","fear@this.com","99d012a07e4ed780bbe73478b845edb1","1","0","0","0","2","3","0","LotsOfFun","0","0","2985264a5db88ca8ccca31f2b4bc402f","0","live","Whiskers","356 bigbear Dr.","","08005","Barnegat","US","NJ","","","","","","","","","","0","","","","","","","0","95","NETBILLING:112656279447","3","855adae945b9ed","0","0","400","0","1","1437705067","1","0","1","","1437705067","1437705067","0","1","1437445780","0","0","112656279446","","","","","","0","0","0","2","4","0","0","0","0","0","TestVerify" "63","29","8","0","1","1","1","1437428601","0","0","1437428601","2","Pullman","445566","91x1h8oqQlRE6","168430114","smart@face.com","99d012a07e4ed780bbe73478b845edb1","1","0","0","0","2","3","0","Pullman","0","0","dd8de79a75d3d6221b4860863b7f99ff","0","Larry","Laugher","123 Dock St.","","07746","FreeLoad","US","NJ","","","","","","","","","","0","","","","","","","0","94","NETBILLING:112388175678","3","755ad6b421eb4a","0","0","400","0","1","1437687801","1","0","1","","1437687801","1437687801","0","1","1437428546","0","0","112388159295","","","","","","0","0","0","2","4","0","0","0","0","0","TestVerify" "62","26","0","0","1","1","1","1437427945","0","0","1437427945","2","RogerWilcox","thetime","e0DyzkCgfvOR2","168430114","busty@likes.com","99d012a07e4ed780bbe73478b845edb1","0","0","0","0","2","3","0","RogerWilcox","0","0","e00d6abf15894beea286d19ea6184985","0","smart","face","123 Elm St.","","19456","Freehold","US","NJ","","","","","","","","","","0","","","","","","","0","93","NETBILLING:112449975913","3","155ad681a8b386","0","0","400","0","1","1437687145","1","0","1","","1437687145","1437687145","0","1","1437427738","0","0","112449975912","","","","","","0","0","0","0","1","0","0","0","0","0","Type-In" "37","15","3","0","1","1","1","1433466637","0","0","1433466637","5","TedBear","nobody","12NkxG1ieKapk","2610666395","raise5@live.com","f43a69e5d12af5af257a5cdfe664858d","0","0","0","0","0","0","0","TedBea","0","0","ab65bbdf546435a3483d6f1e119a37a4","0","","","325 Oak St","","","Freehold","","NJ","","","","","","","","","","0","","","","","","","0","48","NETBILLING:112452783533","3","95570f70cbac2d","0","0","1000","0","1","1435281037","5","0","1","","1435281037","1435281037","0","5","1433466636","0","0","112452783532","","","","","","0","0","0","3","8","0","0","0","0","0","NewAdministrator" "36","15","3","0","1","0","0","0","0","0","1433466570","5","UnderToes","nobody","761qTNNV1LKHo","2610666395","raise4@live.com","f43a69e5d12af5af257a5cdfe664858d","0","0","0","0","0","0","0","UnderToes","0","0","ce4ea98bed24b37339bfcab67afe8119","0","","","325 Oak St","","","Freehold","","NJ","","","","","","","","","","0","","","","","","","0","0","3","8","5","0","0","0","3","0","0","NewAdministrator" "30","13","0","0","1","1","0","1432333221","0","0","1432333221","5","WhatsUpDoc","howdy","41vsEAXYngDkE","168430114","eat@food.de","99d012a07e4ed780bbe73478b845edb1","0","0","0","0","2","3","0","WhatsUpDoc","0","0","3be8aaa9f3fb13e825712a7302c32eb9","0","Right","Thru","123 Oak St.","","07746","Freehold","US","NJ","","","","","","","","","","0","","","","","","","0","41","NETBILLING:112672326360","3","8555fab64edea7","0","0","1500","0","1","1435011621","4","0","1","","1435011621","1435011621","0","4","1432333156","0","0","112672309977","","","","","","0","0","0","0","8","0","0","0","0","0","Type-In" "15","11","0","0","1","1","0","1432143123","0","0","1432143123","5","Zelda","waytogo","9ce4TZ5ttTmlY","168430114","raise@live.com","f43a69e5d12af5af257a5cdfe664858d","1","0","0","0","2","3","0","Zelda","0","0","69b66b12016903eaa94a83a2c2c46af5","0","","NetBillin","345 Oak St.","","07746","Manalapan","US","NJ","","","","","","","","","","0","","","","","","","0","18","NETBILLING:112385676459:A|15","3","5555cc5126315a","0","0","0","0","1","0","3","0","1","112385676459","1432402323","1432402323","0","3","1432143122","0","0","112385676459:A","","","","","","0","0","0","0","8","0","0","0","0","0","Type-In"
NuSOAP Example 2
This example continues from above, and is a complete example of how to call it:
<?php require_once('nusoap/lib/nusoap.php'); $url = 'http://nats.site.com/admin_api.php'; // change to be the domain of your NATS install $username = 'NATSADMIN'; // your admin username $apikey = '3385e1b470b0864e27a9b648da6c0692'; // your api key $client = new nusoap_client($url.'?wsdl', true); $client->setCredentials($username,$apikey); // Check for an error $err = $client->getError(); if ($err) { // Display the error echo 'Constructor error' . $err . "\n"; exit; // At this point, you know the call that follows will fail } $values = array( 'state' => 'NJ', //matching all members who have a state = NJ 'orderby' => 'username DESC', //sort the matching results by username, but this time in descending order 'loginid' => 8 //and further refining the results only to those NJ members who joined via affiliate with loginid = 8 ); $result = $client->call('search_member_info', $values, 'natsapiadmin_wsdl'); //for purposes of displaying the output echo '<PRE>'; print_r($result); echo '</PRE>'; ?>
NuSOAP Example 2 output
The output will be a dump of members matching both state = NJ and loginid = 8, sorted by username in descending order, and will contain the corresponding fields (which could be input into a spreadsheet program):
"memberid","identid","loginid","networkid","refurl_lookup_id","status","trial","joined","expired","last_login","stamp","siteid","username","password","cryptpass","ip","email","session","mailok","flat_price","first_login","third_party_partner_id","cascadeid","cascade_item_id","token","original_username","renamed","marked","token_hash","max_password_display_time","firstname","lastname","address1","address2","zip","city","country","state","shipping_firstname","shipping_lastname","shipping_address1","shipping_address2","shipping_zip","shipping_city","shipping_country","shipping_state","phone","xsell_success","xsell_message","custom1","custom2","custom3","custom4","custom5","last_modified","member_subscription_id","memberidx","billerid","statid","cost","cost_charge","spent","refunded","charges","next_rebill","optionid","rebills","active","upgradeid","expires","nats_expires","biller_expires","original_optionid","created_date","loginid_faceigned","identid_faceigned","gateway_token","passthrough1","passthrough2","passthrough3","passthrough4","passthrough5","forced_optionid","defaulted_optionid","campaignid","programid","tourid","adtoolid","subid1","subid2","countryid","promotionalid","loginid_nice" "63","29","8","0","1","1","1","1437428601","0","0","1437428601","2","Pullman","445566","91x1h8oqQlRE6","168430114","smart@face.com","99d012a07e4ed780bbe73478b845edb1","1","0","0","0","2","3","0","Pullman","0","0","dd8de79a75d3d6221b4860863b7f99ff","0","Larry","Laugher","123 Dock St.","","07746","FreeLoad","US","NJ","","","","","","","","","","0","","","","","","","0","94","NETBILLING:112388175678","3","755ad6b421eb4a","0","0","400","0","1","1437687801","1","0","1","","1437687801","1437687801","0","1","1437428546","0","0","112388159295","","","","","","0","0","0","2","4","0","0","0","0","0","TestVerify" "64","29","8","0","1","1","1","1437445867","0","0","1437445867","2","LotsOfFun","andmetoo","628Ea/L1HBQbs","168430114","fear@this.com","99d012a07e4ed780bbe73478b845edb1","1","0","0","0","2","3","0","LotsOfFun","0","0","2985264a5db88ca8ccca31f2b4bc402f","0","live","Whiskers","356 bigbear Dr.","","08005","Barnegat","US","NJ","","","","","","","","","","0","","","","","","","0","95","NETBILLING:112656279447","3","855adae945b9ed","0","0","400","0","1","1437705067","1","0","1","","1437705067","1437705067","0","1","1437445780","0","0","112656279446","","","","","","0","0","0","2","4","0","0","0","0","0","TestVerify" "70","29","8","0","1","1","1","1437599981","0","0","1437599981","2","BrotherTest","5555555","0bU0rln36N/yY","168430114","fri@day.com","99d012a07e4ed780bbe73478b845edb1","1","0","0","0","2","3","0","BrotherTest","0","0","d47ac11ce88e7cf0baebe7dd5f1c0381","0","Joe","Smoe","123 Anywhere Rd","","07764","Deal","US","NJ","","","","","","","","","","0","","","","","","","0","101","NETBILLING:112385275771","3","855b008ca29b26","0","0","400","0","1","1437859181","1","0","1","","1437859181","1437859181","0","1","1437599946","0","0","112385275770","","","","","","0","0","0","2","4","0","0","0","0","0","TestVerify" "71","29","8","0","1","1","1","1437600472","0","0","1437600472","2","AnotherTest","friendly","b5/bQiYLz71Mg","168430114","lov@off.com","99d012a07e4ed780bbe73478b845edb1","1","0","0","0","2","3","0","AnotherTest","0","0","c1a7159241d86828971680a6c3c183e3","0","pully","Rizzo","456 Nile Dr.","","08723","Brick","US","NJ","","","","","","","","","","0","","","","","","","0","102","NETBILLING:112468846446","3","855b00a8fcc789","0","0","400","0","1","1437859672","1","0","1","","1437859672","1437859672","0","1","1437600399","0","0","112468830063","","","","","","0","0","0","2","4","0","0","0","0","0","TestVerify"
Complete list of output parameters
search_member_info will output the following parameters:
• memberid
• identid
• loginid
• networkid
• refurl_lookup_id
• status
• trial
• joined
• expired
• last_login
• stamp
• siteid
• username
• password
• cryptpass
• ip
• email
• session
• mailok
• flat_price
• first_login
• third_party_partner_id
• cascadeid
• cascade_item_id
• token
• original_username
• renamed
• marked
• token_hash
• max_password_display_time
• firstname
• lastname
• address1
• address2
• zip
• city
• country
• state
• shipping_firstname
• shipping_lastname
• shipping_address1
• shipping_address2
• shipping_zip
•
shipping_city
• shipping_country
• shipping_state
• phone
• xsell_success
• xsell_message
• custom1
• custom2
• custom3
• custom4
• custom5
• last_modified
• member_subscription_id
• memberidx
• billerid
• statid
• cost
• cost_charge
• spent
• refunded
• charges
• next_rebill
• optionid
• rebills
• active
• upgradeid
• expires
• nats_expires
• biller_expires
• original_optionid
• created_date
• loginid_assigned
• identid_assigned
• gateway_token
• passthrough1
• passthrough2
• passthrough3
• passthrough4
• passthrough5
• forced_optionid
• defaulted_optionid
• campaignid
• programid
• tourid
• adtoolid
• subid1
• subid2
• countryid
• promotionalid
• loginid_nice