Difference between revisions of "NATS4 REST API Get Profit Loss Report"
From TMM Wiki
Jump to navigationJump to searchLine 102: | Line 102: | ||
**'''''type: string''''' | **'''''type: string''''' | ||
**'''''optional''' | **'''''optional''' | ||
− | * '''filter_groupid''' - Only see stats for the specific affiliate group id passed in. ( | + | * '''filter_groupid''' - Only see stats for the specific affiliate group id passed in. (NATS 5.0.2.2) |
**'''''type: string''''' | **'''''type: string''''' | ||
**'''''optional''' | **'''''optional''' |
Latest revision as of 15:03, 6 April 2023
GET /profitlossreport
Description
- NATS4 supports an API resource to grab all the stats used within the NATS profit and loss report. This is available on NATS version 4.1.7.1 and above.
Note: this API is deprecated. We recommend using GET /report/profit-loss instead.
Resource URL
- http://domain/api/report/profitloss
- Replace domain with the nats domain
- GET
Response Format
- JSON
- HTTP headers
Parameters
Paremeters can be sent as url encoded params.
- view
- type: string
- optional
- The breakdown of the report to display. Possible options for view are - :
- period
- month
- year
- site_group
- option
- tour
- site
- subid1
- subid2
- program
- login
- adtool
- promotional
- biller
- demographic
- refurl
And the other parameters this API call can take
- period - Which period of time to select data for. See below for more information regarding the periods within NATS.
- type: integer
- optional
- start - Freeform start date for the stats. This field is required if 'period' set to 8
- type: string
- optional
- end - Freeform end date for the stats. This field is required if 'period' is set to 8
- type: string
- optional
- acct_rep - View the profit and loss report as an account rep. Will only see stats for affiliates assigned to the account rep
- type: string
- optional
- filter_loginid - Only see stats for the specifc login ID passed in.
- type: string
- optional
- filter_campaignid - Only see stats for the specific campaign ID for the affiliate. (Can only be used if filter_loginid is passed in)
- type: string
- optional
- filter_siteid - Only see stats for the specific site ID passed in.
- type: string
- optional
- filter_tourid - Only see stats for the specific tour ID passed in.
- type: string
- optional
- filter_optionid - Only see stats for the specific option ID passed in.
- type: string
- optional
- filter_adtoolid - Only see stats for the specific adtool ID passed in.
- type: string
- optional
- filter_billerid - Only see stats for the specific biller ID passed in.
- type: string
- optional
- filter_programid - Only see stats for the specific program ID passed in.
- type: string
- optional
- filter_countryid - Only see stats for the specific Country ID passed in.
- type: string
- optional
- natscode - Breakdown the NATS code and only view stats associated with the NATS code.
- type: string
- optional
- no_inhouse - Remove in-house traffic from the returned report.
- type: string
- optional
- no_typein - Remove type-in traffic from the returned report.
- type: string
- optional
- filter_process_type - Only see stats for the specific process type passed in. See below for more information regarding the periods within NATS
- type: string
- optional
- filter_groupid - Only see stats for the specific affiliate group id passed in. (NATS 5.0.2.2)
- type: string
- optional
Periods
# | Name | Argument Description |
---|---|---|
0 | current | Current Period |
1 | last | Last Period |
2 | today | Today |
3 | yesterday | Yesterday |
4 | week | This Week |
5 | month | This Month |
6 | year | This Year |
7 | all | All Time |
8 | free | Freeform (start and end parameters must be set if using this) |
Process Types
! # | Name | Nice Name |
0 | cc | Credit Cards |
1 | check | Check (ACH) |
2 | dialer | Dialer |
3 | elv | ELV/EU Debit |
4 | asian | Asian Debit/CC (JCB) |
5 | ob | Online Banking |
6 | sms | Premium SMS |
7 | 900 | Web 900 |
8 | inv | Invoiced |
9 | trans | Transfer |
10 | combo | Combination |
11 | pre | PrePaid |
12 | phone | Pay by Phone |
13 | gphone | Global Pay by Phone |
14 | dp | Direct Pay |
15 | instant | Instant Payment |
16 | idl | iDEAL |
17 | snp | SNAP Card |
18 | cnd | China Debit |
19 | knd | Korean Debit |
20 | eay | EasyBuy |
21 | pys | PaySafe Card |
22 | bpy | BPay |
23 | eao | Epagadao |
24 | prz | Przelewy24 |
25 | voucher | Voucher |
26 | idv | Identification Verification |
27 | pound | Pound Number |
28 | dtm | Direct to Mobile |
29 | bcoin | Bit Coin |
30 | bd | Bank Debit |
31 | poa | Purchase on Account |
32 | sof | Sofort Banking |
33 | paypal | PayPal |
34 | psc | Pay Safe Card |
35 | cbuy | Click and Buy |
36 | gpay | Giropay |
37 | eps | EPS |
38 | mpass | Mpass |
39 | pin | Pin Code |
40 | atm | ATM |
41 | cash | Cash |
42 | ewallet | E-Wallet |
43 | va | Virtual Account |
44 | dc | Debit Cards |
45 | astro | AstroPay |
46 | sepa | SEPA |
47 | tgreso | Teleingreso |
48 | telepay | Telepay |
49 | poliau | POLi (AU) |
50 | polinz | POLi (NZ) |
51 | ypay | YellowPay |
52 | apc | AstroPayCard |
53 | gc | Gift Card |
54 | wap | WAP |
55 | mobile | mobile |
56 | maestro | Maestro |
57 | bccard | bccard |
58 | mistercash | MisterCash |
59 | enets | eNets |
60 | abaqoos | Abaqoos |
61 | poli | POLi |
62 | neosurf | Neosurf |
63 | epaybg | ePay bg |
64 | safetpapy | SafetPapy |
65 | toditocash | toditoCash |
66 | banklink | Banklink |
67 | ekonto | eKonto |
68 | sporopay | Sporopay |
69 | unet | unet |
70 | ticketp | Ticket Premium |
71 | postepay | Postepay |
72 | euteller | Euteller |
73 | qiwi | Qiwi |
74 | boletoo | Boletoo Bancario |
75 | ymoney | YandexMoney |
76 | switch | Switch |
77 | bz | Barzahlen |
78 | io | Interac online |
79 | crypto | Cryptocurrency |
80 | alipay | Alipay |
81 | argencard | Argencard |
82 | astropaydirect | AstropayDirect |
83 | banamex | Banamex |
84 | bancodechile | Bancodechile |
85 | bancodeoccidente | Bancodeoccidente |
86 | bancodobrasil | bancodobrasil |
87 | bancontact | bancontact |
88 | bradesco | bradesco |
89 | brazilpaybanktransfer | brazilpaybanktransfer |
90 | brazilpayboleto | brazilpayboleto |
91 | brazilpaychargecard | brazilpaychargecard |
92 | cashu | cashu |
93 | directpayeu | directpayeu |
94 | directpaymaxeu | directpaymaxeu |
95 | entercash | entercash |
96 | efecty | efecty |
97 | itau | itau |
98 | mcoinz | mcoinz |
99 | multicaja | multicaja |
100 | mybank | mybank |
101 | oxxo | oxxo |
102 | pagoefectivo | pagoefectivo |
103 | pagofacil | pagofacil |
104 | pse | pse |
105 | postfinance | postfinance |
106 | rapipago | rapipago |
107 | redpagos | redpagos |
108 | santander | santander |
109 | safetypay | safetypay |
110 | servipag | servipag |
111 | sofortuberweisung | sofortuberweisung |
112 | tenpay | tenpay |
113 | trustly | trustly |
114 | trustpay | trustpay |
115 | unionpay | unionpay |
116 | verkkopankki | verkkopankki |
117 | viabaloto | viabaloto |
118 | webpay | webpay |
Example Request
GET
http://domain/api/report/profitloss
- Response:
{ "total": { "breakdown": "year", "row": [] }, "rows": [ { "break": 1420088400, "stats": { "name": 1420088400, "wm_joins": 0, "initial": 0, "initial_amount": 0, "initial_affiliate_payout": 0, "trial": 0, "trial_amount": 0, "trial_affiliate_payout": 0, "other_join": 0, "other_join_amount": 0, "other_join_affiliate_payout": 0, "wm_join": 0, "wm_join_affiliate_payout": 0, "rebill": 0, "rebill_amount": 0, "rebill_affiliate_payout": 0, "conversion": 0, "conversion_amount": 0, "conversion_affiliate_payout": 0, "other_recurring": 0, "other_recurring_amount": 0, "other_recurring_affiliate_payout": 0, "void": 0, "void_amount": 0, "void_affiliate_payout": 0, "credit": 0, "credit_amount": 0, "credit_affiliate_payout": 0, "chargeback": 0, "chargeback_amount": 0, "chargeback_affiliate_payout": 0, "insufficient_funds": 0, "insufficient_funds_amount": 0, "insufficient_funds_affiliate_payout": 0, "other_refund": 0, "other_refund_amount": 0, "other_refund_affiliate_payout": 0, "void_reversal": 0, "void_reversal_amount": 0, "void_reversal_affiliate_payout": 0, "credit_reversal": 0, "credit_reversal_amount": 0, "credit_reversal_affiliate_payout": 0, "chargeback_reversal": 0, "chargeback_reversal_amount": 0, "chargeback_reversal_affiliate_payout": 0, "other_reversal": 0, "other_reversal_amount": 0, "other_reversal_affiliate_payout": 0, "seconds_amount": 0, "seconds_affiliate_payout": 0, "wm_join_referral_payout": 0, "affiliate_payout": 0, "referral_payout": 0, "account_rep_payout": 0, "partner_payout": 0, "byoa_payout": 0, "promotional_payout": 0, "charges": 0, "no_cost_registration": 0, "no_cost_registration_amount": 0, "no_cost_registration_affiliate_payout": 0, "ccbill_chargeback": 0, "ccbill_chargeback_amount": 0, "ccbill_chargeback_reversal": 0, "ccbill_chargeback_reversal_amount": 0, "ccbill_conversion": 0, "ccbill_conversion_amount": 0, "ccbill_credit": 0, "ccbill_credit_amount": 0, "ccbill_credit_reversal": 0, "ccbill_credit_reversal_amount": 0, "ccbill_initial": 0, "ccbill_initial_amount": 0, "ccbill_insufficient_funds": 0, "ccbill_insufficient_funds_amount": 0, "ccbill_rebill": 0, "ccbill_rebill_amount": 0, "ccbill_trial": 0, "ccbill_trial_amount": 0, "ccbill_void": 0, "ccbill_void_amount": 0, "ccbill_void_reversal": 0, "ccbill_void_reversal_amount": 0, "impression_trans_affiliate_payout": 0, "qualified_trans_affiliate_payout": 0, "visitor_trans_affiliate_payout": 0, "datebreak": 0, "cachebreak": 0, "ccbill_joins": 0, "ccbill_join_profit": 0, "ccbill_recurring": 0, "ccbill_recurring_profit": 0, "ccbill_reversals": 0, "ccbill_reversal_profit": 0, "ccbill_refunds": 0, "ccbill_refund_loss": 0, "free": 0, "joins": 0, "total_joins": 0, "join_profit": 0, "join_affiliate_payout": 0, "recurring": 0, "total_recurring": 0, "recurring_profit": 0, "recurring_affiliate_payout": 0, "payout": 0, "reversals": 0, "total_reversals": 0, "reversal_profit": 0, "reversal_affiliate_payout": 0, "refunds": 0, "total_refunds": 0, "refund_loss": 0, "refund_affiliate_payout": 0, "rebill_biller_charges": 0, "rebill_referral_payout": 0, "rebill_account_rep_payout": 0, "rebill_partner_payout": 0, "rebill_byoa_payout": 0, "rebill_promotional_payout": 0, "recurring_biller_charges": 0, "recurring_referral_payout": 0, "recurring_account_rep_payout": 0, "recurring_partner_payout": 0, "recurring_byoa_payout": 0, "recurring_promotional_payout": 0, "impression": 0, "visitor": 0, "qualified": 0, "join_hits": 0, "join_submits": 0, "expire": 0 } } ] }
Example Code
PHP
<?php $curl = curl_init(); $data = array( 'view' => 'year', 'start' => '2006-06-06', 'end' => 2015-03-14 ); $data_string = http_build_query($data); $url = 'http://domain/api/report/profitloss?'.$data_string; $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/profitlossreport' params = { 'view': 'year', 'start': '2006-06-06', 'end': '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/profitloss', method: 'GET', qs: { 'view': 'year', 'start': '2006-06-06', 'end': '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/api/report/profitloss?view=year&start=2006-06-06&end=2015-03-14' -H "api-key: 44b5498dbcb481a0d00b404c0169af62" -H "api-username: tmm1phrvezsbu"