NATS4 REST API Get Member Details
From TMM Wiki
Jump to navigationJump to searchGET member/details
Description
Resource URL
- http://domain/api/member/details
- Replace domain with the nats domain
- GET
Response Format
- JSON
- HTTP headers
Parameters
Paremeters can be sent as url encoded params.
There are two types of parameters for this function.
Filters
These are parameters used to specify which member you're looking for. This function will only return one member; use these filters to choose which one.
- memberid
- type: integer
- optional
- session
- type: string
- optional
- memberidx (Ex: If a member joined under Epoch with subscription ID 12345, their memberidx would be EPOCH:12345)
- type: string
- optional
- username
- type: string
- optional
- siteid
- type: integer
- optional
- transactionid (Ex: If a member joined under Segpay with transaction ID 67890, their transactionid would be SEGPAY:67890)
- type: string
- optional
- email
- type: string
- optional
- status
- type: integer
- optional
- token_hash
- type: string
- optional
- subscriptionid
- type: string
- optional
Options
These parameters allow you to specify what data you want to be returned. The member's main information will be returned by default; this specifies what you want in addition to that.
- subscriptions -- return all subscriptions for the member
- type: boolean
- optional
- transactions -- return all transactions for the member (implies subscriptions).
- type: boolean
- optional
- full_info -- whether to also get the info from the member_info table (name, address, zip, country, etc)
- type: boolean
- optional
- ident_details -- whether to also return all the identifier information (ie, instead of just returning identid 1234, also return what programid, siteid, tourid, biller, etc that is)
- type: boolean
- optional
- surfer_actions -- whether to also return data about surfer actions for this member
- type: boolean
- optional
- version added: 4.1.19.1
- loginlogs -- whether to also return data about login history for this member
- type: boolean
- optional
- version added: 4.1.19.1
- notes -- whether to also return data about member notes for this member
- type: boolean
- optional
- version added: 4.1.19.1
- all_data -- same as passing notes, loginlogs, surfer_actions, full_info, subscriptions, transactions, and ident_details
- type: boolean
- optional
- version added: 4.1.19.1
- member_data -- automatically returns a restricted data set intended for exports you can share with members, you may wish to further redact the data before sharing it.
- type: boolean
- optional
- version added: 4.1.19.1
Configurations
- Starting with NATS version 4.1.11.1+ we have a config option in Configuration Admin > Misc section > "API_INCLUDE_BILLER_OPTION_INFO"
- Which you will need to enable to add biller specific option info to get_member_details API function.
Example Request
GET
http://domain/api/member/details
- Response:
{ "memberid": "2", "identid": "6", "loginid": "6", "networkid": "0", "refurl_lookup_id": "2", "status": "1", "trial": "0", "joined": "1402603193", "expired": "0", "last_login": "0", "stamp": "1402603193", "siteid": "1", "username": "testakovsky2", "password": "abc123", "cryptpass": "1f2JYM/vKDxjk", "ip": "10.10.10.79", "email": "hello@toomuchmedia.com", "session": "805dcd81818e7593a909fb4c2f2dadba", "mailok": "1", "flat_price": "0", "first_login": "0", "third_party_partner_id": "0", "cascadeid": "2", "cascade_item_id": "2", "token": "0", "original_username": "testakovsky2", "renamed": "0", "marked": "0", "token_hash": "509f18ef8dd27d6a4fab5ececea7c097", "member_subscription_id": "2", "memberidx": "NETBILLING:111684925893", "billerid": "4", "statid": "8539a066a729f6", "cost": "0", "cost_charge": "0", "spent": "66600", "refunded": "0", "charges": "1", "next_rebill": "1460231993", "optionid": "1", "rebills": "0", "active": "1", "upgradeid": "", "expires": "1460231993", "nats_expires": "1460231993", "biller_expires": "0", "original_optionid": "1", "created_date": "1402603114", "loginid_assigned": "0", "identid_assigned": "0", "gateway_token": "111684925892", "passthrough1": "", "passthrough2": "", "passthrough3": "", "passthrough4": "", "passthrough5": "", "member_identid": "6", "member_loginid": "6", "firstname": "Testakovsky", "lastname": "Test", "address1": "666 666 St", "address2": "", "zip": "11111", "city": "Heck", "country": "US", "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": "Hello, this is a test", "custom2": "", "custom3": "", "custom4": "", "custom5": "", "last_modified": "0", "loginid_nice": "affiliate2", "long_ip": "168430159", "biller": "NETBILLING", "refurl": "No Referring URL", "subscriptions": { "2": { "member_subscription_id": "2", "memberid": "2", "memberidx": "NETBILLING:111684925893", "billerid": "4", "statid": "8539a066a729f6", "stamp": "1402603193", "joined": "1402603193", "expired": "0", "cost": 1250, "cost_charge": "0", "spent": "66600", "refunded": "0", "charges": "1", "next_rebill": "1460231993", "optionid": "1", "rebills": "0", "active": "1", "upgradeid": "", "expires": "1460231993", "nats_expires": "1460231993", "biller_expires": "0", "original_optionid": "1", "created_date": "1402603114", "identid": "6", "loginid": "6", "loginid_assigned": "0", "identid_assigned": "0", "gateway_token": "111684925892", "passthrough1": "", "passthrough2": "", "passthrough3": "", "passthrough4": "", "passthrough5": "", "biller": "NETBILLING" } } }
- Response when passing member_data:
{ "memberid": "92", "identid": "8", "refurl_lookup_id": "31", "status": "0", "trial": "0", "joined": "0", "expired": "0", "last_login": "0", "stamp": "1525877790", "siteid": "1", "username": "davethre7", "password": "safasdfasdfasdf", "cryptpass": "dedVIQC7AVW/A", "ip": "192.168.1.65", "email": "asdf@dddddd.com", "session": "578e34cb694928e4b8a0b210700c14b7", "mailok": "1", "flat_price": "0", "first_login": "0", "third_party_partner_id": "0", "cascadeid": "4", "cascade_item_id": "8", "token": "0", "original_username": "davethre7", "renamed": "0", "marked": "0", "token_hash": "8fe21bb7617b7a380227ccdfcf6d1f6b", "member_subscription_id": "266", "memberidx": "", "billerid": "0", "statid": "05af30c1ed0084", "cost": "0", "cost_charge": "0", "spent": "0", "refunded": "0", "charges": "0", "next_rebill": "0", "optionid": "1", "rebills": "0", "active": "0", "upgradeid": "", "expires": "0", "nats_expires": "0", "biller_expires": "0", "original_optionid": "1", "created_date": "1525877790", "firstname": "sadfasdf", "lastname": "asdfasdf", "address1": "sfsdfqwrq", "address2": "werqwerq", "zip": "qw", "city": "qwerqwer", "country": "TJ", "state": "qwerqw", "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": "", "ident_details": { "programid": { "programid": "2", "program": "sss", "type": "0", "name": "sssssssssss", "deleted": "0" }, "siteid": { "siteid": "1", "site": "site1", "deleted": "0", "name": "site 1" }, "tourid": { "tourid": "1", "tour": "MAIN", "name": "Default Tour", "url": "http://unats.daverod.com", "description": "" }, "optionid": [] }, "long_ip": "c0a80141", "biller": false, "refurl": "No Referring URL", "subscriptions": {"266": { "member_subscription_id": "266", "memberid": "92", "memberidx": "", "billerid": "0", "statid": "05af30c1ed0084", "stamp": "1525877790", "joined": "0", "expired": "0", "cost": "0", "cost_charge": "0", "spent": "0", "refunded": "0", "charges": "0", "next_rebill": "0", "optionid": "1", "rebills": "0", "active": "0", "upgradeid": "", "expires": "0", "nats_expires": "0", "biller_expires": "0", "original_optionid": "1", "created_date": "1525877790", "gateway_token": "", "passthrough1": "", "passthrough2": "", "passthrough3": "", "passthrough4": "", "passthrough5": "", "forced_optionid": "0", "defaulted_optionid": "0", "biller": false }}, "surfer_action": [ { "surfer_action_id": "160", "identid": "1", "session": "578e34cb694928e4b8a0b210700c14b7", "time": "1499868814", "type": "9", "extra1": "2", "extra2": "2", "nice": "Cascade: default, Biller: EPOCH (id: 2), Step Number: 2" }, { "surfer_action_id": "1136", "identid": "8", "session": "578e34cb694928e4b8a0b210700c14b7", "time": "1525890824", "type": "14", "extra1": "7", "extra2": "1", "nice": "Biller CBILLING (id: 7) returned: NATS Decline" } ], "note": [ { "member_note_id": "60", "memberid": "92", "stamp": "1526047880", "note": "note text" }], "loginlog": [ { "member_loginlog_id": "1", "memberid": "92", "log_ip": "c0a81419", "log_time": "1526048007", "description": "test login" }] }
Example Code
PHP
<?php $curl = curl_init(); $data = array( 'session' => '805dcd81818e7593a909fb4c2f2dadba', 'username' => 'testakovsky2', 'full_info' => true, 'subscriptions' => true ); $data_string = http_build_query($data); $url = 'http://domain/api/member/details?'.$data_string; $headers = array( 'api-key: 44b5498dbcb481a0d00b404c0169af62', 'api-username: tmm1phrvezsbu' ); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_URL, $url); $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); ?>
Python
- This example requires pip and the request library which can be installed via pip by: 'pip install requests'
import requests url = 'http://domain/api/member/details' params = { 'username': 'testakovsky2', 'session': '805dcd81818e7593a909fb4c2f2dadba', 'full_info': 'true', 'subscriptions': 'true' } headers = { 'api-key': '44b5498dbcb481a0d00b404c0169af62', 'api-username': 'tmm1phrvezsbu' } res = requests.get(url, params=params, headers=headers) print res.json()
node.js
- This example requires npm and the request module which can be installed via npm by: 'npm install request'
var request = require('request'); var options = { url: 'http://domain/api/member/details', method: 'GET', qs: { 'username': 'testakovsky2', 'session': '805dcd81818e7593a909fb4c2f2dadba', 'full_info': 'true', 'subscriptions': 'true' }, json: true, headers: { 'api-key': '44b5498dbcb481a0d00b404c0169af62', 'api-username': 'tmm1phrvezsbu' } }; function callback(error, response, body) { if (!error && response.statusCode == 200) { console.log(body); } else{ console.log(body); } } request(options, callback);
Curl
curl -X GET 'http://domain/api/member/details?session=805dcd81818e7593a909fb4c2f2dadba&username=testakovsky2&full_info=true&subscriptions=true"