Difference between revisions of "NATS For Networks REST API Affiliate Login Ips"
From TMM Wiki
Jump to navigationJump to search(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
{{NATS for Networks Manual | {{NATS for Networks Manual | ||
− | | | + | | show_rest_api_section = true |
}} | }} | ||
== '''POST /affiliate/affiliate_login_ips''' == | == '''POST /affiliate/affiliate_login_ips''' == | ||
Line 76: | Line 76: | ||
$resp = curl_exec($curl); | $resp = curl_exec($curl); | ||
− | //dumps an associative array representation of the json | + | //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 | // Close request to clear up some resources | ||
curl_close($curl); | curl_close($curl); |
Latest revision as of 16:44, 12 May 2017
POST /affiliate/affiliate_login_ips
Description
- This API function allows you to pull a list of ips that affiliates have logged in from.
Resource URL
- http://domain/api/affiliate/affiliate_login_ips
- Replace domain with the NATS for Networks domain
- POST
Response Format
- JSON
- HTTP headers
Parameters
Paremeters must be sent with the request body. The examples below show the parameters sent as x-www-form-urlencoded
- loginid
- type: integer
- loginid_list
- type: array
- username
- type: string
- username_list
- type: array
- return_type
- type: string
- loginid or username, determines the key index that is returned from the function
Example Request
POST
http://domain/api/affiliate/affiliate_login_ips
- Response:
<pre> [ {"result":"success","message":{"3":{"74.105.95.43":["2015-08-06 03:35:41"],"75.99.182.234":["2016-06-06 15:46:31","2016-06-06 10:40:49","2016-06-01 12:11:09","2016-05-12 11:56:31","2016-01-25 16:01:03","2016-01-07 11:43:31","2015-10-12 10:58:31","2015-07-31 23:09:43","2015-07-29 12:16:10","2015-04-02 13:03:05","2015-03-09 17:14:44","2015-03-06 13:08:51","2015-02-23 17:13:12","2015-02-10 16:14:33","2015-02-10 16:10:25","2015-02-10 16:00:08"],"74.102.35.46":["2015-03-13 23:25:57","2015-03-13 23:22:40"],"98.109.57.8":["2012-08-12 21:23:06"]}}} ]
Example Code
PHP
<?php $curl = curl_init(); $data = array( 'username' => 'productsupport', 'return_type' => 'loginid' ); $url = 'http://domain/api/affiliate/affiliate_login_ips'; $headers = array( 'api-key: 44b5498dbcb481a0d00b404c0169af62', 'api-username: productsupport' ); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data)); $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); ?> ?>