Difference between revisions of "NATS4 REST API Set Affiliate Settings"
From TMM Wiki
Jump to navigationJump to searchLine 178: | Line 178: | ||
$headers = array( | $headers = array( | ||
− | ' | + | 'api-key: 44b5498dbcb481a0d00b404c0169af62', |
− | ' | + | 'api-username: tmm1phrvezsbu' |
); | ); | ||
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH"); | curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH"); | ||
Line 204: | Line 204: | ||
url = 'http://domain/api/affiliate/setsettings' | url = 'http://domain/api/affiliate/setsettings' | ||
headers = { | headers = { | ||
− | ' | + | 'api-key': '44b5498dbcb481a0d00b404c0169af62', |
− | ' | + | 'api-username': 'tmm1phrvezsbu' |
} | } | ||
data = { | data = { | ||
Line 232: | Line 232: | ||
}, | }, | ||
headers: { | headers: { | ||
− | ' | + | 'api-key': '44b5498dbcb481a0d00b404c0169af62', |
− | ' | + | 'api-username': 'tmm1phrvezsbu' |
} | } | ||
}; | }; |
Revision as of 19:21, 26 March 2015
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
- 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
- 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);