Difference between revisions of "NATS4 REST API Get Member Search Info String"
From TMM Wiki
Jump to navigationJump to searchm (→Parameters) |
|||
(3 intermediate revisions by 3 users not shown) | |||
Line 2: | Line 2: | ||
| show_api_admin_section = true | | show_api_admin_section = true | ||
}} | }} | ||
− | == '''GET member/ | + | == '''GET member/search''' == |
'''Description''' | '''Description''' | ||
*[[NATS4]] supports an API resource to get a CSV result for members. The result is a comma separated value string. | *[[NATS4]] supports an API resource to get a CSV result for members. The result is a comma separated value string. | ||
Line 22: | Line 22: | ||
== '''Parameters''' == | == '''Parameters''' == | ||
− | '''''Paremeters can be sent as url encoded params. All parameters are optional so if none are entered, all member information will be displayed in the form of a | + | '''''Paremeters can be sent as url encoded params. All parameters are optional so if none are entered, all member information will be displayed in the form of a JSON.''.''' |
*username: | *username: | ||
Line 43: | Line 43: | ||
**'''''type: string''''' | **'''''type: string''''' | ||
**'''''optional''''' | **'''''optional''''' | ||
+ | **'''''Most common possible values:''''' | ||
+ | ***0 => never joined | ||
+ | ***1 => active | ||
+ | ***2 => expired | ||
*firstname: | *firstname: | ||
Line 237: | Line 241: | ||
*orderby: | *orderby: | ||
+ | **'''''type: string''''' | ||
+ | **'''''optional''''' | ||
+ | |||
+ | *start: ''Note: When using start without setting count, count will be set to 100'' | ||
**'''''type: string''''' | **'''''type: string''''' | ||
**'''''optional''''' | **'''''optional''''' | ||
Line 244: | Line 252: | ||
'''GET''' | '''GET''' | ||
− | <nowiki>http://domain/api/member/ | + | <nowiki>http://domain/api/member/search</nowiki> |
*Response on success: | *Response on success: | ||
Line 267: | Line 275: | ||
$data_string = http_build_query($data); | $data_string = http_build_query($data); | ||
− | $url = 'http://domain/api/member/ | + | $url = 'http://domain/api/member/search?'.$data_string; |
$headers = array( | $headers = array( | ||
Line 292: | Line 300: | ||
import json | import json | ||
− | url = 'http://domain/api/member/ | + | url = 'http://domain/api/member/search' |
payload = { | payload = { | ||
Line 314: | Line 322: | ||
var options = { | var options = { | ||
− | url: 'http://domain/api/member/ | + | url: 'http://domain/api/member/search', |
method: 'GET', | method: 'GET', | ||
qs: { | qs: { | ||
Line 343: | Line 351: | ||
'''Curl''' | '''Curl''' | ||
<pre> | <pre> | ||
− | curl -X GET 'http://domain/api/member/ | + | curl -X GET 'http://domain/api/member/search?memberid=191' -H "api-key: 44b5498dbcb481a0d00b404c0169af62" -H "api-username: tmm1phrvezsbu" |
</pre> | </pre> | ||
[[Category:NATS4 API Articles]] | [[Category:NATS4 API Articles]] |
Latest revision as of 10:18, 17 January 2018
GET member/search
Description
- NATS4 supports an API resource to get a CSV result for members. The result is a comma separated value string.
Resource URL
- http://domain/api/member/search
- Replace domain with the nats domain
- GET
Response Format
- JSON
- HTTP headers
Parameters
Paremeters can be sent as url encoded params. All parameters are optional so if none are entered, all member information will be displayed in the form of a JSON..
- username:
- type: string
- optional
- memberid:
- type: string
- optional
- email:
- type: string
- optional
- password:
- type: string
- optional
- status:
- type: string
- optional
- Most common possible values:
- 0 => never joined
- 1 => active
- 2 => expired
- firstname:
- type: string
- optional
- loginip:
- type: string
- optional
- marked:
- type: string
- optional
- lastname:
- type: string
- optional
- address1:
- type: string
- optional
- zip:
- type: string
- optional
- city:
- type: string
- optional
- address2:
- type: string
- optional
- state:
- type: string
- optional
- country:
- type: string
- optional
- mailok:
- type: string
- optional
- custom1:
- type: string
- optional
- custom2:
- type: string
- optional
- custom3:
- type: string
- optional
- custom4:
- type: string
- optional
- custom5:
- type: string
- optional
- statid:
- type: string
- optional
- subscription:
- type: string
- optional
- billerid:
- type: string
- optional
- cascadeid:
- type: string
- optional
- biller_transid:
- type: string
- optional
- ip:
- type: string
- optional
- trans_type_id:
- type: string
- optional
- Most common possible values:
- 1 => initial
- 2 => rebill
- 3 => trial
- 4 => credit
- 5 => conversion
- 6 => chargeback
- 7 => manual
- 8 => seconds
- 9 => expire
- 10 => cancel
- 11 => impression_trans
- 12 => visitor_trans
- 13 => qualified_trans
- 14 => join_hits_trans
- 15 => join_submits_trans
- 19 => void
- 24 => pending_initial
- 25 => pending_rebill
- 26 => pending_trial
- 27 => pending_conversion
- 28 => insufficient_funds
- 29 => manual_trial
- 30 => credit_reversal
- 31 => chargeback_reversal
- 32 => void_reversal
- 33 => insufficient_funds_reversal
- 34 => pre_initial
- 35 => pre_rebill
- 36 => pre_trial
- 37 => pre_conversion
- 38 => no_cost_registration
- nats_transaction_id:
- type: string
- optional
- siteid:
- type: string
- optional
- tourid:
- type: string
- optional
- optionid:
- type: string
- optional
- affiliate:
- type: string
- optional
- loginid:
- type: string
- optional
- natscode:
- type: string
- optional
- programid:
- type: string
- optional
- subid1:
- type: string
- optional
- subid2:
- type: string
- optional
- period:
- type: string
- optional
- 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
- 9 => Unix Timestamp (raw value)
- start_time:
- type: string
- optional
- Note: If specify an Start time, you must specify Period=8
- end_time:
- type: string
- optional
- Note: If specify an End time, you must specify Period=8
- count:
- type: string
- optional
- orderby:
- type: string
- optional
- start: Note: When using start without setting count, count will be set to 100
- type: string
- optional
Example Request
GET
http://domain/api/member/search
- Response on success:
"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","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","campaignid","programid","tourid","adtoolid","subid1","subid2","countryid","promotionalid","loginid_nice" "191","24","1","0","2","2","0","1406911271","0","1426369483","1426475009","1","chrometest6","bakllzasdf","eda2Maqx0IPt2","168430255","asdf@asdf.com","fb6a5cc872353766d98e4642768a1617","1","0","1426368048","0","2","16","0","chrometest6","0","0","75c00099d4c1ffba3977391e319c01e6","Test","asdfsadf","asdfsadf","asdfasd","66666","asdfasdf","US","asdfsad","","","","","","","","","","0","","","","","","","0","219","NETBILLING:112075379434","4","653dbc302e46fb","0","0","33300","0","1","1435768871","5","0","1","","0","0","0","5","1406911234","0","0","112075199231","","","","","","0","3","1","0","0","0","0","0","tmm1phrvezsbu"
This result can be imported into your spread sheet program.
Example Code
PHP
<?php $curl = curl_init(); $data = array( 'memberid' => '191', ); $data_string = http_build_query($data); $url = 'http://domain/api/member/search?'.$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 import json url = 'http://domain/api/member/search' payload = { 'memberid': 191 } headers = { 'api-key': '44b5498dbcb481a0d00b404c0169af62', 'api-username': 'tmm1phrvezsbu' } res = requests.get(url, params=payload, 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/search', method: 'GET', qs: { 'memberid': 191 }, 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/search?memberid=191' -H "api-key: 44b5498dbcb481a0d00b404c0169af62" -H "api-username: tmm1phrvezsbu"