Difference between revisions of "NATS5 REST API Affiliate GET current"
From TMM Wiki
Jump to navigationJump to search(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{NATS5 Manual |
− | | | + | | show_api_admin_affiliate_section = true |
}} | }} | ||
== '''GET /affiliate/current''' == | == '''GET /affiliate/current''' == | ||
+ | |||
'''Description''' | '''Description''' | ||
* Get data for current affiliate | * Get data for current affiliate | ||
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 20: | Line 21: | ||
None | None | ||
+ | == '''Example Request''' == | ||
+ | Method: '''GET'''<br/> | ||
+ | URL: <nowiki>http://domain/api/affiliate/current</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 | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | |||
== '''Example Code''' == | == '''Example Code''' == | ||
Line 33: | Line 120: | ||
$url = 'http://yourdomain.com'; //set your NATS URL here | $url = 'http://yourdomain.com'; //set your NATS URL here | ||
− | $data = array( | + | $data = array(); |
− | |||
− | ); | ||
$request = Array( | $request = Array( | ||
Line 76: | Line 161: | ||
</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 15:58, 9 August 2019
GET /affiliate/current
Description
- Get data for current affiliate
Resource URL
- http://domain/api/affiliate/current
- Replace domain with the nats domain
- GET
Response Format
- JSON
- HTTP headers
Parameters
None
Example Request
Method: GET
URL: http://domain/api/affiliate/current
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 }
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(); $request = Array( 'method' => 'GET', 'path' => 'v1/affiliate/current', '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); ?>