NATS For Networks REST API Get Transaction Report

From TMMwiki
Jump to: navigation, search
NATS For Networks
REST API
API Overview
GET /affiliate/search
POST /affiliate/affiliate_login_ips
GET /creative/get_creative_fields
GET /creative/get_creative_rules
PATCH /creative/undelete_creative
PATCH /creative/edit_creative_rules
PATCH /creative/edit_creative
PATCH /creative/delete_creative
POST /creative/delete_creative_rules
POST /creative/add_creative_rule
POST /creative/add_creative
GET /offer/check_orderid_exists
GET /report/profitloss
GET /report/transaction
GET /transaction/transaction_payout_preview
GET /service/ping




GET /report/transaction

Description

  • NATS for Networks supports an API resource to grab all the stats used within the NATS transactions report.


Resource URL

  • http://domain/api/service/profitloss
  • Replace domain with the nats domain

Request Method

  • GET

Response Format

  • JSON

Authentication

  • HTTP headers

Parameters

    • period - Which period of time to select data for. See below for more information regarding the periods within NATS.
    • start - start date for the stats. Used when period is not sent or set to 8
    • end - end date for the stats. Used when period is not sent or set to 8
    • filter_affiliate - Only see stats for specific affiliate
    • filter_loginid - Only see stats for the specifc login ID passed in.
    • filter_campaignid - Only see stats for the specific campaign ID for the affiliate. (Can only be used if filter_loginid is passed in)
    • filter_offerid - Only see stats for the specific site ID passed in.
    • filter_landingpageid - Only see stats for the specific tour ID passed in.
    • filter_adtoolid - Only see stats for the specific adtool ID passed in.
    • filter_programid - Only see stats for the specific program ID passed in.
    • filter_countryid - Only see stats for the specific Country ID passed in.
    • no_inhouse - 0 for all affiliates, 1 to exclude inhouse.
    • trans_type - Type of transactions to return. Default is all.
    • filter_external_clickid - search for a specific affiliate _ocid.
    • filter_transaction_hash - search for an internal click_hash.
    • trans_start - Number of transactions to offset default 0.
    • trans_count - Number of transactions to return default 100.

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 (See also the start and end parameters above)

Example Code

PHP

<?php
$curl = curl_init();

$data = array(
    'period' => 2,
    '
);

$data_string = http_build_query($data);
$url = 'http://domain/api/report/transaction?'.$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);
?>