Offerit REST API Search Affiliate
From Offerit
Revision as of 16:23, 12 May 2017 by Offeritnick (talk | contribs)
GET affiliate/search
Description
- Offerit 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 Offerit domain
- GET
Response Format
- JSON
- HTTP headers
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
- type: integer
- optional
- username
- type: string
- optional
- email
- type: string
- optional
- firstname
- type: string
- optional
- lastname
- type: string
- optional
- address
- type: string
- optional
- city
- type: string
- optional
- zip_code
- type: string
- optional
- country
- type: string
- optional
- company
- type: string
- optional
- deleted
- type: string
- optional
- end
- type: string
- optional
- aim
- type: string
- optional
- icq
- type: string
- optional
- inhouse
- type: string
- optional
- join_count
- type: integer
- optional
- join_date
- type: string
- optional
- join_ip
- type: string
- optional
- join_range
- type: string
- optional
- login_date
- type: string
- optional
- login_ip
- type: string
- optional
- login_range
- type: string
- optional
- min_pay
- type: string
- optional
- name
- type: string
- optional
- trackingcode
- type: string
- optional
- orderby
- type: string
- optional
- pay_range
- type: string
- optional
- payvia_details
- type: string
- optional
- payvia_type_id
- type: integer
- optional
- ratio
- type: string
- optional
- raw_clicks
- type: integer
- optional
- continuity_count
- type: string
- optional
- refid
- type: string
- optional
- ref
- type: string
- optional
- void_count
- type: string
- optional
- sales_rep
- type: string
- optional
- search_ref
- type: string
- optional
- start
- type: string
- optional
- state
- type: string
- optional
- stats_end
- type: string
- optional
- stats_period
- type: string
- optional
- stats_start
- type: string
- optional
- status
- type: string
- optional
- total_earned
- type: string
- optional
- total
- type: string
- optional
- type
- type: string
- optional
- unq_clicks
- type: string
- optional
- url
- type: string
- optional
- return_payvia_info: If passed as any non empty value, the function will return affiliate payvia information within a sub array called "payvia_details"
- type: string
- optional
- 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"
- type: string
- optional
- 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"
- type: string
- optional
Example Request
GET
http://domain/api/affiliate/search
- Response:
{ "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@offerit.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 response $output = json_decode($resp, true); if($output !== NULL) { //json was valid. Dump the decoded array print_r($output); } else { //invalid json, just dump the raw response print_r($resp); } // 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"