Difference between revisions of "NATS5 REST API Affiliate GET search"
From TMM Wiki
Jump to navigationJump to search(6 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{NATS5 Manual |
− | | | + | | show_api_admin_affiliate_section = true |
}} | }} | ||
== '''GET /affiliate/search''' == | == '''GET /affiliate/search''' == | ||
+ | |||
'''Description''' | '''Description''' | ||
* Search affiliates | * Search affiliates | ||
Line 9: | Line 10: | ||
*Replace domain with the nats domain | *Replace domain with the nats domain | ||
− | '''[[ | + | '''[[NATS5_REST_API_Overview#Allowed_HTTP_Request_Methods|Request Method''']] |
*GET | *GET | ||
'''Response Format''' | '''Response Format''' | ||
*JSON | *JSON | ||
− | '''[[ | + | '''[[NATS5_REST_API_Overview#Authentication|Authentication]]''' |
*HTTP headers | *HTTP headers | ||
Line 22: | Line 23: | ||
* '''as_array''' | * '''as_array''' | ||
− | ** type: boolean_digit | + | ** type: boolean_digit (0 or 1) |
** optional | ** optional | ||
* '''count''' | * '''count''' | ||
Line 49: | Line 50: | ||
** optional | ** optional | ||
* '''return_w9''' | * '''return_w9''' | ||
− | ** type: boolean_digit | + | ** type: boolean_digit (0 or 1) |
** optional | ** optional | ||
* '''start''' | * '''start''' | ||
Line 55: | Line 56: | ||
** optional | ** optional | ||
* '''widget''' | * '''widget''' | ||
− | ** type: boolean_digit | + | ** type: boolean_digit (0 or 1) |
** optional | ** optional | ||
* '''address''' | * '''address''' | ||
Line 88: | Line 89: | ||
** optional (default value: =) | ** optional (default value: =) | ||
* '''deleted''' | * '''deleted''' | ||
− | ** type: boolean_digit | + | ** type: boolean_digit (0 or 1) |
** optional | ** optional | ||
* '''email_compare''' | * '''email_compare''' | ||
Line 131: | Line 132: | ||
** optional | ** optional | ||
* '''join_range''' | * '''join_range''' | ||
+ | ** type: boolean_digit (0 or 1) | ||
+ | *** 0: before (join_date) | ||
+ | *** 1: after (join_date) | ||
** optional | ** optional | ||
* '''join_submits''' | * '''join_submits''' | ||
Line 233: | Line 237: | ||
* '''username_compare''' | * '''username_compare''' | ||
** type: string | ** type: string | ||
− | ** optional (default value: | + | ** optional (default value: like) |
* '''username''' | * '''username''' | ||
** type: string | ** type: string | ||
Line 244: | Line 248: | ||
** optional | ** optional | ||
+ | == '''Example Request''' == | ||
+ | Method: '''GET'''<br/> | ||
+ | URL: <nowiki>http://domain/api/affiliate/search</nowiki><br/> | ||
+ | Query String: <nowiki>count=1000&start=0&status=0&deleted=1</nowiki><br/> | ||
+ | |||
+ | Response: | ||
+ | <pre> | ||
+ | [ | ||
+ | { | ||
+ | "loginid": "1", | ||
+ | "username": "productsupport", | ||
+ | "deleted": "0", | ||
+ | "type": "225", | ||
+ | "skinid": "102", | ||
+ | "payvia_type_id": "1", | ||
+ | "status": "0", | ||
+ | "join_date": "1533153053", | ||
+ | "inhouse": "0", | ||
+ | "api_key": "", | ||
+ | "tmmid": "0", | ||
+ | "origin": "0", | ||
+ | "language": "", | ||
+ | "payout_period_id": "0", | ||
+ | "2fa_enabled": "0", | ||
+ | "firstname": "TMM", | ||
+ | "lastname": "Support", | ||
+ | "email": "send@test.com", | ||
+ | "date_posted": "1533153053", | ||
+ | "join_ip": "0", | ||
+ | "last_login": null, | ||
+ | "last_login_ip": "", | ||
+ | "reviewed": "0", | ||
+ | "minimum_payout": "0", | ||
+ | "bonus": "0", | ||
+ | "bonus_used": "0", | ||
+ | "verify": "", | ||
+ | "reason": "", | ||
+ | "unencoded": "0", | ||
+ | "startpage": "internal.php", | ||
+ | "rep_baseline": "0", | ||
+ | "company": "Too Much Media", | ||
+ | "url": "", | ||
+ | "tel": "", | ||
+ | "icq": "", | ||
+ | "aim": "", | ||
+ | "msn": "", | ||
+ | "address1": null, | ||
+ | "address2": null, | ||
+ | "city": "", | ||
+ | "state": "", | ||
+ | "country": "", | ||
+ | "zip_code": "", | ||
+ | "tax_id_or_ssn": "", | ||
+ | "invoicer": "0", | ||
+ | "req_docs": "0", | ||
+ | "w9": "0", | ||
+ | "mailok": "0", | ||
+ | "trust_level": "0", | ||
+ | "new_notification": "0", | ||
+ | "latest_news": "0", | ||
+ | "default_campaign": "0", | ||
+ | "default_program": "0", | ||
+ | "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", | ||
+ | "admin_overview_affiliates_order": null, | ||
+ | "admin_overview_sites_order": null, | ||
+ | "tos_time": null, | ||
+ | "tos_ip": null, | ||
+ | "status_nice": "Active", | ||
+ | "custom_permissions": 0 | ||
+ | }, | ||
+ | { | ||
+ | "loginid": "2", | ||
+ | "username": "tmmvaffiliate", | ||
+ | "deleted": "0", | ||
+ | "type": "225", | ||
+ | "skinid": "102", | ||
+ | "payvia_type_id": "1", | ||
+ | "status": "0", | ||
+ | "join_date": "1533153134", | ||
+ | "inhouse": "0", | ||
+ | "api_key": "", | ||
+ | "tmmid": "0", | ||
+ | "origin": "0", | ||
+ | "language": "", | ||
+ | "payout_period_id": "0", | ||
+ | "2fa_enabled": "0", | ||
+ | "firstname": "Test", | ||
+ | "lastname": "Acct", | ||
+ | "email": "send2@test.com", | ||
+ | "date_posted": "1533153134", | ||
+ | "join_ip": "3232235862", | ||
+ | "last_login": "1533153175", | ||
+ | "last_login_ip": "3232235862", | ||
+ | "reviewed": "0", | ||
+ | "minimum_payout": "50", | ||
+ | "bonus": "0", | ||
+ | "bonus_used": "0", | ||
+ | "verify": "", | ||
+ | "reason": "", | ||
+ | "unencoded": "0", | ||
+ | "startpage": "internal.php", | ||
+ | "rep_baseline": "0", | ||
+ | "company": "TMM", | ||
+ | "url": "www.toomuchmedia.com", | ||
+ | "tel": "", | ||
+ | "icq": "", | ||
+ | "aim": "", | ||
+ | "msn": "", | ||
+ | "address1": "23 Main St", | ||
+ | "address2": null, | ||
+ | "city": "Springfield", | ||
+ | "state": "MO", | ||
+ | "country": "US", | ||
+ | "zip_code": "65619", | ||
+ | "tax_id_or_ssn": "", | ||
+ | "invoicer": "0", | ||
+ | "req_docs": "0", | ||
+ | "w9": "0", | ||
+ | "mailok": "1", | ||
+ | "trust_level": "0", | ||
+ | "new_notification": "0", | ||
+ | "latest_news": "0", | ||
+ | "default_campaign": "0", | ||
+ | "default_program": "0", | ||
+ | "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", | ||
+ | "admin_overview_affiliates_order": null, | ||
+ | "admin_overview_sites_order": null, | ||
+ | "tos_time": null, | ||
+ | "tos_ip": null, | ||
+ | "status_nice": "Active", | ||
+ | "custom_permissions": 0 | ||
+ | }, | ||
+ | { | ||
+ | "loginid": "4", | ||
+ | "username": "AccountRep", | ||
+ | "deleted": "0", | ||
+ | "type": "100", | ||
+ | "skinid": "102", | ||
+ | "payvia_type_id": "1", | ||
+ | "status": "0", | ||
+ | "join_date": "1565382535", | ||
+ | "inhouse": "0", | ||
+ | "api_key": "", | ||
+ | "tmmid": "0", | ||
+ | "origin": "0", | ||
+ | "language": "en", | ||
+ | "payout_period_id": "0", | ||
+ | "2fa_enabled": "0", | ||
+ | "firstname": "Account", | ||
+ | "lastname": "Rep", | ||
+ | "email": "test@test.test", | ||
+ | "date_posted": "1565382535", | ||
+ | "join_ip": "0", | ||
+ | "last_login": null, | ||
+ | "last_login_ip": "", | ||
+ | "reviewed": "0", | ||
+ | "minimum_payout": "1", | ||
+ | "bonus": "0", | ||
+ | "bonus_used": "0", | ||
+ | "verify": "", | ||
+ | "reason": "", | ||
+ | "unencoded": "0", | ||
+ | "startpage": "internal.php", | ||
+ | "rep_baseline": "0", | ||
+ | "company": "TMM", | ||
+ | "url": "toomuchmedia.com", | ||
+ | "tel": "111-111-1111", | ||
+ | "icq": "111111111", | ||
+ | "aim": "testaffiliate", | ||
+ | "msn": "testaffiliate", | ||
+ | "address1": "1 affiliate st", | ||
+ | "address2": null, | ||
+ | "city": "City", | ||
+ | "state": "State", | ||
+ | "country": "US", | ||
+ | "zip_code": "11111", | ||
+ | "tax_id_or_ssn": "111111111", | ||
+ | "invoicer": "0", | ||
+ | "req_docs": "0", | ||
+ | "w9": "0", | ||
+ | "mailok": "0", | ||
+ | "trust_level": "0", | ||
+ | "new_notification": "0", | ||
+ | "latest_news": "0", | ||
+ | "default_campaign": "0", | ||
+ | "default_program": "0", | ||
+ | "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", | ||
+ | "admin_overview_affiliates_order": null, | ||
+ | "admin_overview_sites_order": null, | ||
+ | "tos_time": null, | ||
+ | "tos_ip": null, | ||
+ | "status_nice": "Active", | ||
+ | "custom_permissions": 0 | ||
+ | }, | ||
+ | { | ||
+ | "loginid": "3", | ||
+ | "username": "affiliateTest", | ||
+ | "deleted": "0", | ||
+ | "type": "0", | ||
+ | "skinid": "102", | ||
+ | "payvia_type_id": "1", | ||
+ | "status": "0", | ||
+ | "join_date": "1565382535", | ||
+ | "inhouse": "0", | ||
+ | "api_key": "", | ||
+ | "tmmid": "0", | ||
+ | "origin": "0", | ||
+ | "language": "en", | ||
+ | "payout_period_id": "0", | ||
+ | "2fa_enabled": "0", | ||
+ | "firstname": "Test", | ||
+ | "lastname": "Affiliate", | ||
+ | "email": "itai.levi@toomuchmedia.com", | ||
+ | "date_posted": "1565382535", | ||
+ | "join_ip": "0", | ||
+ | "last_login": null, | ||
+ | "last_login_ip": "", | ||
+ | "reviewed": "0", | ||
+ | "minimum_payout": "1", | ||
+ | "bonus": "0", | ||
+ | "bonus_used": "0", | ||
+ | "verify": "", | ||
+ | "reason": "", | ||
+ | "unencoded": "0", | ||
+ | "startpage": "internal.php", | ||
+ | "rep_baseline": "0", | ||
+ | "company": "TMM", | ||
+ | "url": "toomuchmedia.com", | ||
+ | "tel": "111-111-1111", | ||
+ | "icq": "111111111", | ||
+ | "aim": "testaffiliate", | ||
+ | "msn": "testaffiliate", | ||
+ | "address1": "1 affiliate st", | ||
+ | "address2": null, | ||
+ | "city": "City", | ||
+ | "state": "State", | ||
+ | "country": "US", | ||
+ | "zip_code": "11111", | ||
+ | "tax_id_or_ssn": "111111111", | ||
+ | "invoicer": "0", | ||
+ | "req_docs": "0", | ||
+ | "w9": "0", | ||
+ | "mailok": "0", | ||
+ | "trust_level": "0", | ||
+ | "new_notification": "0", | ||
+ | "latest_news": "0", | ||
+ | "default_campaign": "0", | ||
+ | "default_program": "0", | ||
+ | "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", | ||
+ | "admin_overview_affiliates_order": null, | ||
+ | "admin_overview_sites_order": null, | ||
+ | "tos_time": null, | ||
+ | "tos_ip": null, | ||
+ | "status_nice": "Active", | ||
+ | "custom_permissions": 0 | ||
+ | } | ||
+ | ] | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | |||
== '''Example Code''' == | == '''Example Code''' == | ||
Line 251: | Line 572: | ||
<?php | <?php | ||
− | + | $headers = array( //set your username and API key here | |
− | + | 'api-key: 44b5498dbcb481a0d00b404c0169af62', | |
− | $headers = array( | + | 'api-username: tmm1phrvezsbu' |
− | |||
− | |||
); | ); | ||
+ | $url = 'http://yourdomain.com'; //set your NATS URL here | ||
− | $data = | + | $data = Array( |
− | + | 'count' => 1000, | |
+ | 'start' => 0, | ||
+ | 'status' => 0, | ||
+ | 'deleted' => 1, | ||
); | ); | ||
Line 268: | Line 591: | ||
); | ); | ||
− | $url = ' | + | /*code below is the same for (almost) every API call */ |
+ | |||
+ | $curl = curl_init(); | ||
+ | |||
+ | $url = $url.'/api/'.$request['path']; | ||
$query = http_build_query($request['data']); | $query = http_build_query($request['data']); | ||
if($request['method'] == 'GET'){ | if($request['method'] == 'GET'){ | ||
− | $url = $url.'?'.$query; | + | //add query string parameters to the end of the url |
+ | $url = $url.'?'.$query; | ||
}else{ | }else{ | ||
+ | //send parameters as POST fields | ||
curl_setopt($curl, CURLOPT_POST, 1); | curl_setopt($curl, CURLOPT_POST, 1); | ||
− | curl_setopt($curl, CURLOPT_POSTFIELDS, $query); | + | curl_setopt($curl, CURLOPT_POSTFIELDS, $query); |
+ | |||
if($request['method'] != 'POST'){ | if($request['method'] != 'POST'){ | ||
$headers[] ='X-HTTP-Method: '.$request['method']; //send custom request method | $headers[] ='X-HTTP-Method: '.$request['method']; //send custom request method | ||
Line 294: | Line 624: | ||
</pre> | </pre> | ||
− | [[Category: | + | [[Category:NATS5_REST_APIs]] |
− | [[Category: | + | [[Category:NATS5_REST_affiliate_Collection]] |
[[Category:Autogenerated_Wiki_Article]]<!-- Remove this tag when customizing a wiki article. The article will no longer be automatically updated --> | [[Category:Autogenerated_Wiki_Article]]<!-- Remove this tag when customizing a wiki article. The article will no longer be automatically updated --> | ||
+ | [[Category:Autogenerated_Rest_Sample]]<!-- This article has a generated REST API Sample from our unit testing system. Also remove if customizing the wiki article --> |
Latest revision as of 11:41, 30 November 2024
GET /affiliate/search
Description
- Search affiliates
Resource URL
- http://domain/api/affiliate/search
- Replace domain with the nats domain
- GET
Response Format
- JSON
- HTTP headers
Parameters
Parameters can be sent as url encoded params
- as_array
- type: boolean_digit (0 or 1)
- optional
- count
- type: digit
- optional
- end
- optional
- orderby
- optional
- output_format
- optional
- return_payvia_info
- optional
- return_referred_info
- optional
- return_group_enabled
- type: digit
- optional
- return_payout_period_enabled
- type: digit
- optional
- return_program_enabled
- type: digit
- optional
- return_referring_info
- optional
- return_w9
- type: boolean_digit (0 or 1)
- optional
- start
- type: digit
- optional
- widget
- type: boolean_digit (0 or 1)
- optional
- address
- type: string
- optional
- address_compare
- type: string
- optional (default value: =)
- aim
- type: string
- optional
- aim_compare
- type: string
- optional (default value: =)
- city
- type: string
- optional
- city_compare
- type: string
- optional (default value: =)
- company
- type: string
- optional
- company_compare
- type: string
- optional (default value: =)
- country
- type: string
- optional
- country_compare
- type: string
- optional (default value: =)
- deleted
- type: boolean_digit (0 or 1)
- optional
- email_compare
- type: string
- optional (default value: =)
- email
- type: string
- optional
- firstname_compare
- type: string
- optional (default value: =)
- firstname
- type: string
- optional
- groupid
- type: digit
- optional
- groupid_compare
- type: string
- optional (default value: =)
- group_disabled
- type: digit
- optional
- group_enabled
- type: digit
- optional
- icq_compare
- type: string
- optional (default value: =)
- icq
- type: string
- optional
- inhouse
- optional
- join_count
- optional
- join_date
- optional
- join_hits
- optional
- join_ip
- optional
- join_range
- type: boolean_digit (0 or 1)
- 0: before (join_date)
- 1: after (join_date)
- optional
- type: boolean_digit (0 or 1)
- join_submits
- optional
- lastname_compare
- type: string
- optional (default value: =)
- lastname
- type: string
- optional
- login_date
- optional
- loginid_compare
- type: string
- optional (default value: =)
- loginid
- type: digit
- optional
- login_ip
- optional
- login_range
- optional
- min_pay
- optional
- name
- type: string
- optional
- name_compare
- type: string
- optional (default value: =)
- natscode_compare
- type: string
- optional (default value: =)
- natscode
- type: string
- optional
- pay_range
- optional
- payvia_details
- optional
- payvia_type_id
- optional
- payout_period_disabled
- type: digit
- optional
- payout_period_enabled
- type: digit
- optional
- program_disabled
- type: digit
- optional
- program_enabled
- type: digit
- optional
- ratio
- optional
- raw_hits
- optional
- rebill_count
- optional
- refid
- optional
- ref
- optional
- refund_count
- optional
- sales_rep
- optional
- search_ref
- optional
- state_compare
- type: string
- optional (default value: =)
- state
- type: string
- optional
- stats_end
- optional
- stats_period
- optional
- stats_start
- optional
- status
- type: digit
- optional
- status_compare
- type: string
- optional (default value: =)
- text_search
- optional
- total_earned
- optional
- total
- optional
- type
- type: digit
- optional
- unq_hits
- optional
- url
- optional
- username_compare
- type: string
- optional (default value: like)
- username
- type: string
- optional
- zip_code_compare
- type: string
- optional (default value: =)
- zip_code
- type: string
- optional
Example Request
Method: GET
URL: http://domain/api/affiliate/search
Query String: count=1000&start=0&status=0&deleted=1
Response:
[ { "loginid": "1", "username": "productsupport", "deleted": "0", "type": "225", "skinid": "102", "payvia_type_id": "1", "status": "0", "join_date": "1533153053", "inhouse": "0", "api_key": "", "tmmid": "0", "origin": "0", "language": "", "payout_period_id": "0", "2fa_enabled": "0", "firstname": "TMM", "lastname": "Support", "email": "send@test.com", "date_posted": "1533153053", "join_ip": "0", "last_login": null, "last_login_ip": "", "reviewed": "0", "minimum_payout": "0", "bonus": "0", "bonus_used": "0", "verify": "", "reason": "", "unencoded": "0", "startpage": "internal.php", "rep_baseline": "0", "company": "Too Much Media", "url": "", "tel": "", "icq": "", "aim": "", "msn": "", "address1": null, "address2": null, "city": "", "state": "", "country": "", "zip_code": "", "tax_id_or_ssn": "", "invoicer": "0", "req_docs": "0", "w9": "0", "mailok": "0", "trust_level": "0", "new_notification": "0", "latest_news": "0", "default_campaign": "0", "default_program": "0", "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", "admin_overview_affiliates_order": null, "admin_overview_sites_order": null, "tos_time": null, "tos_ip": null, "status_nice": "Active", "custom_permissions": 0 }, { "loginid": "2", "username": "tmmvaffiliate", "deleted": "0", "type": "225", "skinid": "102", "payvia_type_id": "1", "status": "0", "join_date": "1533153134", "inhouse": "0", "api_key": "", "tmmid": "0", "origin": "0", "language": "", "payout_period_id": "0", "2fa_enabled": "0", "firstname": "Test", "lastname": "Acct", "email": "send2@test.com", "date_posted": "1533153134", "join_ip": "3232235862", "last_login": "1533153175", "last_login_ip": "3232235862", "reviewed": "0", "minimum_payout": "50", "bonus": "0", "bonus_used": "0", "verify": "", "reason": "", "unencoded": "0", "startpage": "internal.php", "rep_baseline": "0", "company": "TMM", "url": "www.toomuchmedia.com", "tel": "", "icq": "", "aim": "", "msn": "", "address1": "23 Main St", "address2": null, "city": "Springfield", "state": "MO", "country": "US", "zip_code": "65619", "tax_id_or_ssn": "", "invoicer": "0", "req_docs": "0", "w9": "0", "mailok": "1", "trust_level": "0", "new_notification": "0", "latest_news": "0", "default_campaign": "0", "default_program": "0", "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", "admin_overview_affiliates_order": null, "admin_overview_sites_order": null, "tos_time": null, "tos_ip": null, "status_nice": "Active", "custom_permissions": 0 }, { "loginid": "4", "username": "AccountRep", "deleted": "0", "type": "100", "skinid": "102", "payvia_type_id": "1", "status": "0", "join_date": "1565382535", "inhouse": "0", "api_key": "", "tmmid": "0", "origin": "0", "language": "en", "payout_period_id": "0", "2fa_enabled": "0", "firstname": "Account", "lastname": "Rep", "email": "test@test.test", "date_posted": "1565382535", "join_ip": "0", "last_login": null, "last_login_ip": "", "reviewed": "0", "minimum_payout": "1", "bonus": "0", "bonus_used": "0", "verify": "", "reason": "", "unencoded": "0", "startpage": "internal.php", "rep_baseline": "0", "company": "TMM", "url": "toomuchmedia.com", "tel": "111-111-1111", "icq": "111111111", "aim": "testaffiliate", "msn": "testaffiliate", "address1": "1 affiliate st", "address2": null, "city": "City", "state": "State", "country": "US", "zip_code": "11111", "tax_id_or_ssn": "111111111", "invoicer": "0", "req_docs": "0", "w9": "0", "mailok": "0", "trust_level": "0", "new_notification": "0", "latest_news": "0", "default_campaign": "0", "default_program": "0", "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", "admin_overview_affiliates_order": null, "admin_overview_sites_order": null, "tos_time": null, "tos_ip": null, "status_nice": "Active", "custom_permissions": 0 }, { "loginid": "3", "username": "affiliateTest", "deleted": "0", "type": "0", "skinid": "102", "payvia_type_id": "1", "status": "0", "join_date": "1565382535", "inhouse": "0", "api_key": "", "tmmid": "0", "origin": "0", "language": "en", "payout_period_id": "0", "2fa_enabled": "0", "firstname": "Test", "lastname": "Affiliate", "email": "itai.levi@toomuchmedia.com", "date_posted": "1565382535", "join_ip": "0", "last_login": null, "last_login_ip": "", "reviewed": "0", "minimum_payout": "1", "bonus": "0", "bonus_used": "0", "verify": "", "reason": "", "unencoded": "0", "startpage": "internal.php", "rep_baseline": "0", "company": "TMM", "url": "toomuchmedia.com", "tel": "111-111-1111", "icq": "111111111", "aim": "testaffiliate", "msn": "testaffiliate", "address1": "1 affiliate st", "address2": null, "city": "City", "state": "State", "country": "US", "zip_code": "11111", "tax_id_or_ssn": "111111111", "invoicer": "0", "req_docs": "0", "w9": "0", "mailok": "0", "trust_level": "0", "new_notification": "0", "latest_news": "0", "default_campaign": "0", "default_program": "0", "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", "admin_overview_affiliates_order": null, "admin_overview_sites_order": null, "tos_time": null, "tos_ip": null, "status_nice": "Active", "custom_permissions": 0 } ]
Example Code
PHP
<?php $headers = array( //set your username and API key here 'api-key: 44b5498dbcb481a0d00b404c0169af62', 'api-username: tmm1phrvezsbu' ); $url = 'http://yourdomain.com'; //set your NATS URL here $data = Array( 'count' => 1000, 'start' => 0, 'status' => 0, 'deleted' => 1, ); $request = Array( 'method' => 'GET', 'path' => 'v1/affiliate/search', 'data' => $data ); /*code below is the same for (almost) every API call */ $curl = curl_init(); $url = $url.'/api/'.$request['path']; $query = http_build_query($request['data']); if($request['method'] == 'GET'){ //add query string parameters to the end of the url $url = $url.'?'.$query; }else{ //send parameters as POST fields curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $query); if($request['method'] != 'POST'){ $headers[] ='X-HTTP-Method: '.$request['method']; //send custom request method } } curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $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); ?>