NATS5 REST API Member GET search
From TMM Wiki
Jump to navigationJump to search
GET /member/search
Note: This is an autogenerated wiki page for the NATS5 API. There may be additional descriptions or examples available on the NATS 4 API wiki for this API.
Description
- Search for members
Resource URL
- http://domain/api/member/search
- Replace domain with the nats domain
- GET
Response Format
- JSON
- HTTP headers
Parameters
Parameters can be sent as url encoded params
- fields
- type: string_list (Either a comma-separated string of strings, or a JSON array of strings)
- optional
- output_format
- type: string
- optional
- start_time
- type: string
- optional
- end_time
- type: string
- optional
- no_like_searches
- type: boolean_digit (0 or 1)
- optional
- count
- type: digit
- optional (default value: 25)
- start
- type: digit
- optional
- orderby
- type: string
- optional
- as_array
- type: boolean_digit (0 or 1)
- optional
- widget
- type: boolean_digit (0 or 1)
- optional
- additional_flags
- type: json (JSON Object)
- optional
- address1
- type: string
- optional
- address1_compare
- type: string
- optional (default value: =)
- address2
- type: string
- optional
- address2_compare
- type: string
- optional (default value: =)
- affiliate
- type: string
- optional
- billerid
- type: digit
- optional
- billerid_compare
- type: string
- optional (default value: =)
- biller_transid
- type: string
- optional
- campaignid
- type: digit
- optional
- campaignid_compare
- type: string
- optional (default value: =)
- cascadeid
- type: digit
- optional
- cascadeid_compare
- type: string
- optional (default value: =)
- city
- type: string
- optional
- city_compare
- type: string
- optional (default value: =)
- coupon_code
- type: string
- optional
- coupon_code_compare
- type: string
- optional (default value: =)
- couponid
- type: digit
- optional
- couponid_compare
- type: string
- optional (default value: =)
- coupon_revision_id
- type: digit
- optional
- coupon_used
- type: trinary_digit (0, 1, or 2)
- optional
- country
- type: string
- optional
- country_compare
- type: string
- optional (default value: =)
- countryid
- type: digit_list (Either a comma-separated string of digits, or a JSON array of digits)
- optional
- custom1
- type: string
- optional
- custom1_compare
- type: string
- optional (default value: =)
- custom2
- type: string
- optional
- custom2_compare
- type: string
- optional (default value: =)
- custom3
- type: string
- optional
- custom3_compare
- type: string
- optional (default value: =)
- custom4
- type: string
- optional
- custom4_compare
- type: string
- optional (default value: =)
- custom5
- type: string
- optional
- custom5_compare
- type: string
- optional (default value: =)
- custom6
- type: string
- optional
- custom6_compare
- type: string
- optional (default value: =)
- custom7
- type: string
- optional
- custom7_compare
- type: string
- optional (default value: =)
- custom8
- type: string
- optional
- custom8_compare
- type: string
- optional (default value: =)
- custom9
- type: string
- optional
- custom9_compare
- type: string
- optional (default value: =)
- custom10
- type: string
- optional
- custom10_compare
- type: string
- optional (default value: =)
- email
- type: string
- optional
- email_compare
- type: string
- optional (default value: =)
- firstname
- type: string
- optional
- firstname_compare
- type: string
- optional (default value: =)
- ip
- type: string
- optional
- ip_compare
- type: string
- optional (default value: =)
- lastname
- type: string
- optional
- lastname_compare
- type: string
- optional (default value: =)
- loginid
- type: digit
- optional
- loginid_compare
- type: string
- optional (default value: =)
- loginip
- type: string
- optional
- manual
- type: boolean_digit (0 or 1)
- optional
- mailok
- type: boolean_digit (0 or 1)
- optional
- marked
- type: boolean_digit (0 or 1)
- optional
- memberid
- type: digit
- optional
- memberid_compare
- type: string
- optional (default value: =)
- natscode
- type: string
- optional
- natscode_compare
- type: string
- optional (default value: =)
- nats_transaction_id
- type: digit
- optional
- not_logged_in
- type: boolean_digit (0 or 1)
- optional
- optionid
- type: digit
- optional
- optionid_compare
- type: string
- optional (default value: =)
- passthrough1
- type: string
- optional
- passthrough1_compare
- type: string
- optional (default value: =)
- passthrough2
- type: string
- optional
- passthrough2_compare
- type: string
- optional (default value: =)
- passthrough3
- type: string
- optional
- passthrough3_compare
- type: string
- optional (default value: =)
- passthrough4
- type: string
- optional
- passthrough4_compare
- type: string
- optional (default value: =)
- passthrough5
- type: string
- optional
- passthrough5_compare
- type: string
- optional (default value: =)
- password
- type: string
- optional
- period
- type: digit
- optional
- programid
- type: digit
- optional
- programid_compare
- type: string
- optional (default value: =)
- siteid
- type: digit
- optional
- siteid_compare
- type: string
- optional (default value: =)
- subscription
- type: string
- optional
- state
- type: string
- optional
- state_compare
- type: string
- optional (default value: =)
- statid
- type: string
- optional
- status
- type: trinary_digit (0, 1, or 2)
- optional
- status_compare
- type: string
- optional (default value: =)
- subid1
- type: string
- optional
- subid2
- type: string
- optional
- text_search
- type: string
- optional
- tourid
- type: digit
- optional
- tourid_compare
- type: string
- optional (default value: =)
- trans_type_id
- type: digit
- optional
- username
- type: string
- optional
- username_compare
- type: string
- optional (default value: =)
- zip
- type: string
- optional
- zip_compare
- type: string
- optional (default value: =)
Example Request
Method: GET
URL: http://domain/api/member/search
Query String: username=test+username&status=1&firstname=testFirstname
Response:
{ "3": { "memberid": "3", "identid": "4", "loginid": "0", "networkid": "0", "refurl_lookup_id": "2", "landing_page_lookup_id": "0", "status": "1", "trial": "0", "joined": "1565382563", "expired": "0", "last_login": "1565382564", "stamp": "1565382564", "siteid": "1", "username": "test username", "password": "testPassword", "cryptpass": "d3695SDTr1h2k", "ip": "", "email": "test@email.com", "session": "4184eb9f9064c7b773c8dfd159505af4", "mailok": "1", "flat_price": "0", "first_login": "1565382564", "third_party_partner_id": "0", "cascadeid": "0", "cascade_item_id": "0", "token": "0", "original_username": "test username", "renamed": "0", "marked": "0", "token_hash": "f561384f9bf88197514d49fc321d5f85", "max_password_display_time": "0", "locked": "0", "firstname": "testFirstname", "lastname": "testLastname", "address1": "123 address street", "address2": "", "zip": "12345", "city": "testCity", "country": "", "state": "NJ", "shipping_firstname": "", "shipping_lastname": "", "shipping_address1": "", "shipping_address2": "", "shipping_zip": "", "shipping_city": "", "shipping_country": "", "shipping_state": "", "phone": "", "xsell_success": "0", "xsell_message": "", "custom1": "", "custom2": "", "custom3": "", "custom4": "", "custom5": "", "last_modified": "0", "custom6": "", "custom7": "", "custom8": "", "custom9": "", "custom10": "", "campaignid": "0", "programid": "0", "tourid": "1", "optionid": "0", "adtoolid": "0", "subid1": "0", "subid2": "0", "billerid": "0", "countryid": "0", "promotionalid": "0", "loginid_nice": "Type-In", "programid_nice": "Type-In", "campaignid_nice": "Default", "campaign_name": "Default", "siteid_nice": "member_a", "tourid_nice": "Default Tour", "flagged": "0" } }
Example Code
PHP
<?php $headers = array( //set your username and API key here 'api-key: 44b5498dbcb481a0d00b404c0169af62', 'api-username: tmm1phrvezsbu' ); $url = 'http://yourdomain.com'; //set your NATS URL here $data = Array( 'username' => 'test username', 'status' => 1, 'firstname' => 'testFirstname', ); $request = Array( 'method' => 'GET', 'path' => 'v1/member/search', 'data' => $data ); /*code below is the same for (almost) every API call */ $curl = curl_init(); $url = $url.'/api/'.$request['path']; $query = http_build_query($request['data']); if($request['method'] == 'GET'){ //add query string parameters to the end of the url $url = $url.'?'.$query; }else{ //send parameters as POST fields curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $query); if($request['method'] != 'POST'){ $headers[] ='X-HTTP-Method: '.$request['method']; //send custom request method } } curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $resp = curl_exec($curl); //dumps an associative array representation of the json var_dump(json_decode($resp, true)); // Close request to clear up some resources curl_close($curl); ?>