GET affiliate/search
Description
- NATS for Networks supports an API resource to get affiliate info for an affiliate or multiple affiliates based on the parameters entered.
Resource URL
- http://domain/api/affiliate/search
- Replace domain with your NATS for Networks domain
Request Method
Response Format
Authentication
Parameters
Parameters can be sent as url encoded params. All parameters are optional so if none are entered, all affiliate information will be displayed..
- loginid
- username
- email
- firstname
- lastname
- address
- city
- zip_code
- country
- company
- deleted
- end
- aim
- icq
- inhouse
- join_count
- join_date
- join_ip
- join_range
- login_date
- login_ip
- login_range
- min_pay
- name
- trackingcode
- orderby
- pay_range
- payvia_details
- payvia_type_id
- ratio
- raw_clicks
- continuity_count
- refid
- ref
- void_count
- sales_rep
- search_ref
- start
- state
- stats_end
- stats_period
- stats_start
- status
- total_earned
- total
- type
- unq_clicks
- url
- return_payvia_info: If passed as any non empty value, the function will return affiliate payvia information within a sub array called "payvia_details"
- return_referred_info: If passed as any non empty value, the function will return the referring affiliate chain for this account (parent accounts) within a sub array called "referred_details"
- return_referring_info: If passed as any non empty value, the function will return all affiliate accounts referred by this affiliate (child accounts) within a sub array called "referring_details"
Example Request
GET
http://domain/api/affiliate/search
{
"3": {
"loginid": "3",
"username": "affiliate1",
"password": "$6$4Arjzx0l$KexJXqDqIWBtasD54qQh5Tknnj2mm.m3D9ULyAef.GvYdxMO3w3ERStyTzy.VXXPRNsykYLfjQNt8APX0x4Wq.",
"deleted": "0",
"type": "100",
"skinid": "102",
"payvia_type_id": "1",
"status": "0",
"pass_hash": "55718788453dfec428c9fb3.27539735",
"join_date": "1402587397",
"inhouse": "0",
"api_key": "",
"tmmid": "0",
"origin": "0",
"language": "en",
"rss_pass_code": "145b3ce7614671d0a9ebe81f87ac275d",
"payout_period_id": "0",
"firstname": "Test",
"lastname": "Testakovsky",
"email": "hello@toomuchmedia.com",
"date_posted": "1402587397",
"join_ip": "168430159",
"last_login": "1407183950",
"last_login_ip": "168430236",
"reviewed": "1",
"minimum_payout": "50",
"bonus": "0",
"bonus_used": "0",
"verify": "",
"reason": "",
"unencoded": "0",
"startpage": "internal.php",
"rep_baseline": "0",
"company": "Test Company",
"url": "http:\/\/this.is\/test",
"tel": "",
"icq": "",
"aim": "",
"msn": "",
"address1": "666 Lemmy St",
"address2": null,
"city": "Heck",
"state": "NJ",
"country": "US",
"zip_code": "66666",
"tax_id_or_ssn": "",
"invoicer": "0",
"req_docs": "1",
"w9": "1",
"mailok": "1",
"trust_level": "0",
"new_notification": "0",
"latest_news": "1403790938",
"default_campaign": "0",
"default_program": "1",
"default_site": "0",
"pv_instant": "0",
"payout_approval": "0",
"access_preset": "0",
"custom1": "0",
"custom2": "0",
"custom3": "0",
"custom4": "0",
"custom5": "0",
"avatar_ext": "",
"remote_access": "0",
"remote_payment": "0",
"remote_adtool": "0",
"allow_subscription_passthrough": "0",
"allow_option_force": "0",
"status_nice": null,
"payvia_details": [ ]
}
}
Example Code
PHP
<?php
$curl = curl_init();
$data = array(
'username' => 'affiliate1',
);
$data_string = http_build_query($data);
$url = 'http://domain/api/affiliate/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
url = 'http://domain/api/affiliate/search'
params = {
'username': 'affiliate1'
}
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/affiliate/search',
method: 'GET',
qs: {
'username': 'affiliate1'
},
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/affiliate/search?username=affiliate1' -H "api-key: 44b5498dbcb481a0d00b404c0169af62" -H "api-username: tmm1phrvezsbu"