NATS4 REST API Get Member Details
From TMM Wiki
Revision as of 17:03, 13 March 2015 by Tmmtobias0185 (talk | contribs)
GET 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 the member joined under Epoch with subscriptionid 12345, their memberidx would be EPOCH:12345)
- type: string
- optional
- username
- type: string
- optional
- siteid
- type: integer
- optional
- transactionid
- type: integer
- optional
- email
- type: integer
- string
- status
- type: integer
- integer
- 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
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" } } }
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"