NATS4 REST API Get Transaction Payout Report

From TMM Wiki
Revision as of 12:29, 22 November 2017 by TMMJonS (talk | contribs) (→‎Example Code)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
NATS 4
Members Admin
The Members Admin
View Member Details
Add Member
MySQL Auth
Mod Authn DB
Multisite Access
Member Logging
Member Password Retrieval
OpenID Connect
Mod Auth OpenIDC
ID Numbers
SOAP API
API
API Best Practices
WSDL Cache
Add Affiliate
Add Member Note
Admin Get Adtools
Adtool Categories
Adtool Types
Affiliate Get Campaigns
Bulk Import Adtools
Caching
Decode Natscode
Expire Manual Member
Get Affiliate Campaigns
Get Affiliate Hit Data
Get Affiliate Loginids
Get Affiliate Nats Codes
Get Affiliate Payout
Get Affiliate Program Campaign List
Get_Affiliate_Program_Campaign_List
Get Member Details
Get Member Instant Upgrade String
Get Member Package Upgrade String
Get Member Token Rebuy String
Get Member Upsell String
Get Payment Data
Get Payvia Rule
Get Profit Loss Report
Ping
Record Member Login
Search Affiliate Info
Search Member Info
Send Email API Function
Set Affiliate Admin Settings
Set Affiliate Customs
Set Affiliate Defaults
Set Affiliate Information
Set Affiliate Settings
Set Member Details
Set Payment Status
Set Payvia Rule
REST API
API Overview
API Best Practices
REST API PATH UPDATES
Adtools
GET /adtools/admin
GET /adtools/categories
GET /adtools/types
POST /adtools/importdump
Affiliate
GET /affiliate/campaigns
GET /affiliate/hitdata
GET /affiliate/payout
GET /affiliate/searchinfo
POST /affiliate/addaffiliate
POST /affiliate/invoice
PATCH /affiliate/setadminsettings
PATCH /affiliate/setcustoms
PATCH /affiliate/setdefaults
PATCH /affiliate/setinformation
PATCH /affiliate/setpayviainfo
PATCH /affiliate/setsettings
PATCH /affiliate/status
Member
GET /member/authstring
GET /member/details
GET /member/searchinfo
GET /suggestedcanceloffers
PATCH /member/setdetails
PATCH /member/setexpiration
POST /member/addnote
POST /member/recordlogin
PUT /member/expiremanual
PATCH /member/forget
Option
GET /option/options
GET /option/rule
PATCH /option/rule
PATCH/option/text
POST /option/rule
Payments
GET /payments/getpayments
GET /payviarule
PATCH /payments/setstatus
PATCH /payviarule
Report
GET /profitlossreport
Get /transactionpayouts
GET /report/transaction
Service
GET /service/decodenatscode
GET /service/ping
POST /service/sendemail

GET /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

Request Method

  • GET

Response Format

  • JSON

Authentication

  • HTTP headers

Parameters

Paremeters can be sent as url encoded params.

- The breakdown of the report to display. Possible options for view are - :


    • start_time - Freeform start date for the stats.
    • type: string
    • end_time - Freeform end date for the stats.
    • type: string
    • offset - The starting point of the report
    • type: string
    • count - Limit the report to a specific amount of entries
    • type: string


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"