NATS4 REST API Set Affiliate Defaults

From TMM Wiki
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

PATCH /affiliate/setdefaults

Description

  • The /affiliate/setdefaults action is a feature in NATS4 that allows you to change default settings for your affiliates outside of the NATS system. This call will change defaults for ALL affiliates in your NATS system. The response contains one parameter named result. If the modification was successful then result will be 1 or greater. The number represents the amount of changes. If it was not successful then the result will be 0.

Resource URL

  • http://domain/api/affiliate/setdefaults
  • Replace domain with the nats domain

Request Method

  • PATCH

Response Format

  • JSON

Authentication

  • HTTP headers

Parameters

Paremeters must be sent with the request body. The examples below show the parameters sent as x-www-form-urlencoded

  • **NOTE**:

For possible values, please see the Affiliate Default Settings Configuration located in the Configurations Admin under the Affiliate Default Settings section.

  • loginid: The affiliate's login ID
    • type: integer
    • required
  • startpage: What page you want the affiliate to see when they log in
    • type: string
    • optional
  • mailok: Specify if you want affiliates to receive mailings
    • type: string
    • optional
  • live_update_defaults: Specify if you want to immediately update changes in affiliate defaults
    • type: string
    • optional
  • default_stats_view: The first page the affiliate will see on their Stats page
    • type: string
    • optional
  • default_stats_date_range: What range of dates affiliates will see in their stats by default
    • type: string
    • optional
  • default_stats_small_map_1_data: What statistic you want displayed in an affiliate's small map data
    • type: string
    • optional
  • default_stats_small_map_2_data: What statistic you want displayed in an affiliate's large map data
    • type: string
    • optional
  • default_stats_pie_chart_1_data: What statistic you want displayed in each affiliate pie chart
    • type: string
    • optional
  • default_stats_pie_chart_2_data: What statistic you want displayed in each affiliate pie chart
    • type: string
    • optional
  • default_stats_pie_chart_3_data: What statistic you want displayed in each affiliate pie chart
    • type: string:
    • optional:
  • default_stats_pie_chart_4_data: What statistic you want displayed in each affiliate pie chart
    • type: string:
    • optional:
  • default_stats_pie_chart_5_data: What statistic you want displayed in each affiliate pie chart
    • type: string
    • optional
  • default_stats_pie_chart_1_break: What you want each pie chart to be broken down by (site, program, country, etc.)
    • type: string
    • optional
  • default_stats_pie_chart_2_break: What you want each pie chart to be broken down by (site, program, country, etc.)
    • type: string
  • default_stats_pie_chart_3_break: What you want each pie chart to be broken down by (site, program, country, etc.)
    • type: string
    • optional
  • default_stats_pie_chart_4_break: What you want each pie chart to be broken down by (site, program, country, etc.)
    • type: string
    • optional
  • default_stats_pie_chart_5_break: What you want each pie chart to be broken down by (site, program, country, etc.)
    • type: string
    • optional
  • default_stats_mixed_chart_1_type: What type of chart you want your affiliate's mixed statistics to be displayed in
    • type: string
    • optional
  • default_stats_mixed_chart_2_type: What type of chart you want your affiliate's mixed statistics to be displayed in
    • type: string
    • optional
  • default_stats_mixed_chart_1_data: What statistic you want displayed in each affiliate mixed chart
    • type: string
    • optional
  • default_stats_mixed_chart_2_type: What statistic you want displayed in each affiliate mixed chart
    • type: string
    • optional
  • default_stats_multi_graph_data_1: What statistic you want displayed in each affiliate multi graph
    • type: string:
    • optional
  • default_stats_multi_graph_data_2: What statistic you want displayed in each affiliate multi graph
    • type: string
    • optional
  • default_stats_multi_graph_data_3: What statistic you want displayed in each affiliate multi graph
    • type: string
    • optional
  • default_stats_large_map_data: What statistic you want displayed in an affiliate's large map data
    • type: string
    • optional
  • default_stats_comp_data: What statistic you want to be compared in an affiliate's comparison field
    • type: string
    • optional
  • default_stats_order: Set the order that statistics will be displayed in the affiliate stats page
    • type: string
    • optional
  • defaults_stats_table_column1: Set and order what affiliate statistics columns display (raw, unique, join hits, etc)
    • type: string
    • optional
  • default_stats_table_column2: Set and order what affiliate statistics columns display (raw, unique, join hits, etc)
    • type: string
    • optional
  • default_stats_table_column3: Set and order what affiliate statistics columns display (raw, unique, join hits, etc)
    • type: string
    • optional
  • default_stats_table_column4: Set and order what affiliate statistics columns display (raw, unique, join hits, etc)
    • type: string
    • optional
  • default_stats_table_column5: Set and order what affiliate statistics columns display (raw, unique, join hits, etc)
    • type: string
    • optional
  • default_stats_table_column6: Set and order what affiliate statistics columns display (raw, unique, join hits, etc)
    • type: string
    • optional
  • default_stats_table_column7: Set and order what affiliate statistics columns display (raw, unique, join hits, etc)
    • type: string
    • optional
  • default_stats_table_column8: Set and order what affiliate statistics columns display (raw, unique, join hits, etc)
    • type: string
    • optional
  • default_stats_table_column9: Set and order what affiliate statistics columns display (raw, unique, join hits, etc)
    • type: string
    • optional
  • default_adtools_use_defaults: Uses default adtool settings for affiliates
    • type: string
    • optional
  • default_adtools_view: Set the first page the affiliate will be taken to in Affiliate Adtools
    • type: string
    • optional
  • default_adtools_cat_1_type: Set a type of banner for the affiliate to use by default (static, animated, etc)
    • type: string
    • optional
  • default_adtools_cat_2_type: Set a type of hosted gallery to use by default (i.e., free hosted gallery)
    • type: string
    • optional
  • default_adtools_cat_3_type: Set a type of downloadable adtool to use by default (page ads, mailers, etc)
    • type: string
    • optional
  • default_adtools_cat_4_type: Set a cat_4_type
    • type: string
    • optional
  • default_adtools_cat_5_type: Set a type of news feed for affiliates to use by default
    • type: string
    • optional
  • default_adtools_publish_setting: Set the default for when an adtool is published (on, before, or after a date)
    • type: string
    • optional
  • default_adtools_publish_date: The default date available when setting when to publish an adtool
    • type: string
    • optional
  • default_adtools_dump_separater: The punctuation used to separate stat dumps (commas, semi-colons, etc.)
    • type: string
    • optional
  • default_adtools_dump_record_end: The punctuation used to end a stat dump (semicolon, \n, \t)
    • type: string
    • optional
  • default_adtools_dump_field_1: Set dump fields that correspond to your statistics
    • type: string
    • optional
  • default_adtools_dump_field_2: Set dump fields that correspond to your statistics
    • type: string
    • optional
  • default_adtools_dump_field_3: Set dump fields that correspond to your statistics
    • type: string
    • optional
  • default_adtools_dump_field_4: Set dump fields that correspond to your statistics
    • type: string
    • optional
  • default_adtools_dump_field_5: Set dump fields that correspond to your statistics
    • type: string
    • optional
  • default_adtools_dump_field_6: Set dump fields that correspond to your statistics
    • type: string
    • optional
  • default_adtools_dump_field_7: Set dump fields that correspond to your statistics
    • type: string
    • optional
  • default_adtools_dump_field_8: Set dump fields that correspond to your statistics
    • type: string
    • optional
  • default_account_view: What page the affiliate will see first when accessing their account page
    • type: string
    • optional
  • default_account_changes_count: How many recent account changes you want NATS to display
    • type: string
    • optional
  • default_account_changes_order: How you want these changes sorted (change date descending, status ascending, etc)
    • type: string
    • optional
  • default_account_campaign_count: How many affiliate campaigns you want to be visible at once
    • type: string
    • optional
  • default_account_campaign_order: How you want these campaigns to be sorted (shortname ascending, hidden descending, etc)
    • type: string
    • optional
  • default_adtools_use_limits: Automatically use the limits you have set when the page is loaded
    • type: string
    • optional

Example Request

PATCH

http://domain/api/affiliate/setdefaults

  • Response on Sucess:
[
    {
        "result": 1
    }
]
  • Response on Failure:

[

   {
       "result": 0
   }

]

Example Code

PHP

<?php

$data = array(
    'startpage' => 'internal.php?page=xsells',
);

$url = 'http://domain.com/api/affiliate/setdefaults';
$curl = curl_init();

$headers = array(
    'api-key: 44b5498dbcb481a0d00b404c0169af62',
    'api-username: tmm1phrvezsbu'
);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_URL, $url);

$resp = curl_exec($curl);
var_dump($resp);
//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/affiliate/setdefaults'
headers = {
    'api-key': '44b5498dbcb481a0d00b404c0169af62',
    'api-username': 'tmm1phrvezsbu'
}
data =  {
    'startpage': 'internal.php?page=xsells'
 }

res = requests.patch(url, data=data, 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/affiliate/setdefaults',
    method: 'PATCH',
    json: true,
    form: {
        'startpage': 'internal.php?page=xsells'

    },
    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);