NATS4 REST API Get Transaction Payout Report
From TMM Wiki
Jump to navigationJump to searchGET /report/transactionpayouts
Description
- NATS4 supports an API resource to grab all the stats used within the NATS transaction payout report. This is available on NATS version 4.1.7.1 and above.
Resource URL
- http://domain/api/report/transactionpayouts
- Replace domain with the nats domain
- GET
Response Format
- JSON
- HTTP headers
Parameters
Paremeters can be sent as url encoded params.
- The breakdown of the report to display. Possible options for view are - :
Example Request
GET
http://domain/api/report/transactionpayouts
- Response:
array(1) { [2]=> array(64) { ["trans_payment_id"]=> string(1) "2" ["transaction_id"]=> string(1) "3" ["identid"]=> string(2) "26" ["loginid"]=> string(1) "2" ["networkid"]=> string(1) "0" ["date"]=> string(10) "1509595200" ["payment_type"]=> string(14) "Normal Payment" ["payment_amount"]=> string(3) "500" ["payout_change_id"]=> string(1) "4" ["bonus_amount"]=> string(1) "0" ["bonus_change_id"]=> string(1) "0" ["subid1"]=> string(1) "0" ["subid2"]=> string(1) "0" ["campaignid"]=> string(1) "0" ["campaign_name"]=> string(7) "Default" ["programid"]=> string(1) "1" ["program_name"]=> string(11) "testprogram" ["siteid"]=> string(1) "1" ["site_name"]=> string(4) "test" ["tourid"]=> string(1) "1" ["tour_name"]=> string(4) "MAIN" ["optionid"]=> string(1) "1" ["option_name"]=> string(10) "Join here!" ["billerid"]=> string(2) "10" ["biller_name"]=> string(6) "CCBILL" ["country_iso2"]=> string(2) "US" ["country_iso3"]=> string(3) "USA" ["country_isoalpha"]=> string(3) "840" ["country_name"]=> string(13) "United States" ["affiliate_username"]=> string(7) "AAAAAAA" ["affiliate_email"]=> string(13) "test@test.com" ["member_subscription_id"]=> string(1) "4" ["memberid"]=> string(1) "4" ["member_username"]=> string(10) "8uf4pzkm2n" ["member_email"]=> string(0) "" ["member_city"]=> string(0) "" ["member_state"]=> string(0) "" ["member_zip"]=> string(0) "" ["member_country"]=> string(0) "" ["member_shipping_city"]=> string(0) "" ["member_shipping_state"]=> string(0) "" ["member_shipping_zip"]=> string(0) "" ["member_shipping_country"]=> string(0) "" ["member_ip_long"]=> string(1) "0" [member_ip"]=> string(7) "0.0.0.0" ["refurl_lookup_id"]=> string(1) "3" ["memberidx"]=> string(15) "NATS:1509632470" ["custom1"]=> string(0) "" ["custom2"]=> string(0) "" ["custom3"]=> string(0) "" ["custom4"]=> string(0) "" ["custom5"]=> string(0) "" ["custom6"]=> string(0) "" ["custom7"]=> string(0) "" ["custom8"]=> string(0) "" ["custom9"]=> string(0) "" ["custom10"]=> string(0) "" ["passthrough1"]=> string(0) "" ["passthrough2"]=> string(0) "" ["passthrough3"]=> string(0) "" ["passthrough4"]=> string(0) "" ["passthrough5"]=> string(0) "" ["refurl"]=> string(8) "Bookmark" ["payment_type_id"]=> string(1) "0" } }
Example Code
PHP
<?php $curl = curl_init(); $url = 'http://domain.com/api/report/transactionpayouts/?start_time=2017-11-02&end_time=2017-11-03&offset=0&count=10'; $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/transactionpayouts' params = { 'start_time': '2006-06-06', 'end_time': '2015-03-14' } 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/report/transactionpayouts', method: 'GET', qs: { 'start_time': '2006-06-06', 'end_time': '2015-03-14' }, 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.com/api/report/transactionpayouts/?start_time=2017-11-02&end_time=2017-11-03&offset=0&count=10' -H "api-key:44b5498dbcb481a0d00b404c0169af62" -H "api-username:tmm1phrvezsbu"