Difference between revisions of "NATS4 REST API Set Affiliate Settings"

From TMM Wiki
Jump to navigationJump to search
Line 4: Line 4:
 
== '''PATCH /affiliate/setsettings''' ==
 
== '''PATCH /affiliate/setsettings''' ==
 
'''Description'''  
 
'''Description'''  
*The  /affiliate/setsettings endpoint is a feature in [[NATS4]] that allows you to change settings for your [[Ct#Affiliate|affiliates]] outside of the [[NATS]] system. The response contains one parameter named result. If the modification was successful then result will be 1 or greater. If it was not successful then the result will be 0.  
+
*The  /affiliate/setsettings action is a feature in [[NATS4]] that allows you to change settings for your [[Ct#Affiliate|affiliates]] outside of the [[NATS]] system. The response contains one parameter named result. If the modification was successful then result will be 1 or greater. If it was not successful then the result will be 0.  
  
 
'''Resource URL'''
 
'''Resource URL'''

Revision as of 00:49, 18 March 2015

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

Description

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

Resource URL

  • http://domain/api/affiliate/setsettings
  • 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

  • loginid: is the affiliates loginid
    • type: integer
    • required
  • notify_password: is the notify_password value
    • type: integer
    • optional
  • nofify_payvia: is the notify_payvia value
    • type: integer
    • optional
  • notify_payvia_info: is the notify_payvia_info value
    • type: integer
    • optional
  • notify_defaults: is the notify_defaults value
    • type: integer
    • optional
  • notify_details: is the notify_details value
    • type: integer
    • optional
  • notify_settings: is the notify_settings value
    • type: integer
    • optional
  • notify_member_change: is the notify_member_change value
    • type: integer
    • optional
  • notify_member_voiced: is the notify_member_voided value
    • type: integer
    • optional
  • notify_member_chargeback: is the nofity_member_chargeback value
    • type: integer
    • optional
  • notify_member_credited: is the notify_member_credited value
    • type: integer
    • optional
  • notify_member_insufficient: is the notify_member_insufficient value
    • type: integer
    • optional
  • notify_member_cancelled: is the notify_member_cancelled value
    • type: integer
    • optional
  • notify_member_rebilled: is the notify_member_rebilled value
    • type: integer
    • optional
  • notify_member_joined: is the notify_member_joined balue
    • type: integer
    • optional
  • verify_details: is the verify_details value
    • type: integer
    • optional
  • verify_settings: is the verify_settings value
    • type: integer
    • optional
  • verify_defaults: is the veryify_defaults value
    • type: integer
    • optional
  • verify_payvia: is the verify_payvia value
    • type: integer
    • optional
  • verify_payvia_info: is the verify_payvia_info value
    • type: integer
    • optional
  • email_promotional: is the email_promotional value
    • type: integer
    • optional
  • email_on_notify: is the email_on_notify value
    • type: integer
    • optional
  • email_on_member_change: is the email_on_member_change value
    • type: integer
    • optional
  • email_on_member_voided: is the email_on_member_voided value
    • type: integer
    • optional
  • email_on_member_chargeback: is the email_on_member_chargeback value
    • type: integer
    • optional
  • email_on_member_credited: is the email_on_member_credited value
    • type: integer
    • optional
  • email_on_member_insufficient: is the email_on_member_insufficient val
    • type: integer
    • optional
  • email_on_member_cancelled: is the email_on_member_cancelled value
    • type: integer
    • optional
  • email_on_member_rebilled: is the email_on_member_rebilled value
    • type: integer
    • optional
  • email_on_member_joined: is the email_on_member_joined value
    • type: integer
    • optional
  • access_preset: is the access_preset value
    • type: integer
    • optional
  • post_member_approval: is the post_member_approval value
    • type: integer
    • optional
  • post_member_rebill: is the post_member_rebill value
    • type: integer
    • optional
  • post_member_upgrade: is the post_member_upgrade value
    • type: integer
    • optional
  • post_member_expire: is the post_member_expire value
    • type: integer
    • optional
  • post_member_insufficient: is the post_member_insufficient value
    • type: string
    • optional
  • post_member_credit: is the post_member_credit value
    • type: string
    • optional
  • post_member_chargeback: is the post_member_chargeback value
    • type: string
    • optional
  • post_member_void: is the post_member_void value
    • type: string
    • optional
  • post_member_upgradedeny: is the post_member_ugpradedeny value
    • type: string
    • optional
  • post_member_change_details: is the post_member_changedetails value
    • type: string
    • optional

Example Request

PATCH

http://domain/api/v1/affiliate/setsettings

  • Response:
[
    {
        "result": 2
    }
]

Example Code

PHP

<?php

$data = array(
    'email_on_member_insufficient' => 1,
    'notify_password' => 1
);

$url = 'http://domain.com/api/affiliate/setsettings';
$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/setsettings'
headers = {
    'api_key': '44b5498dbcb481a0d00b404c0169af62',
    'api_username': 'tmm1phrvezsbu'
}
data =  {
    'email_on_member_insufficient': 1,
    'notify_password': 1
 }

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/setsettings',
    method: 'PATCH',
    json: true,
    form: {
        'email_on_member_insufficient': 1,
        'notify_password': 1

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