NATS4 REST API Set Affiliate Defaults
From TMM Wiki
Revision as of 19:22, 26 March 2015 by Tmmtobias0185 (talk | contribs)
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
- PATCH
Response Format
- JSON
- 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/v1/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);