NATS4 REST API Set Affiliate Payvia Info

From TMMwiki
Jump to: navigation, search
NATS 4
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/upsellstring
GET /member/tokenrebuystring
GET /member/instantupgradestring
GET /member/packageupgradestring
GET /member/signupplusstring
GET /member/cancelstring
GET /member/details
GET /member/searchinfo
GET /suggestedcanceloffers
PATCH /member/setdetails
PATCH /member/setexpiration
POST /member/addnote
POST /member/recordlogin
PUT /member/expiremanual
Option
GET /option/getrule
PATCH /option/editrule
POST /option/addrule
PUT /option/edittext
Payments
GET /payments/getpayments
GET /payviarule
PATCH /payments/setstatus
PATCH /payviarule
Report
GET /profitlossreport
Service
GET /service/decodenatscode
GET /service/ping
POST /service/sendemail

PATCH /affiliate/setpayviainfo

Description

  • The /affiliate/setpayviainfo action is a feature in NATS4 that allows you to set the affiliate payvia info settings

Resource URL

  • http://domain/api/affiliate/setpayviainfo
  • 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: string
    • required
  • payvia_type_id: is the id of the payvia that the loginid should be switched to
    • type: string
    • required
  • payvia_info: is an array containing arrays of info to update for the payvia type.
    • type: array
    • required

Example Request

PATCH

http://domain/api/affiliate/setpayviainfo

  • Response:
[
    {
        "field":"Payvia Type",
        "result":"Updated Payvia Type to 1 for loginid 1"
    },
    {
        "field":"Pay To",
        "result":"Updated Payvia Info: 'Pay To' is now 'TestPayTo'"
    },
    {
        "field":"Address",
        "result":"Updated Payvia Info: 'Address' is now 'Riga, Latvia'"
    }
]

Example Code

PHP

<?php
$curl = curl_init();

$payvia_info = array();
$payvia_info[] = array(
    'field' => 'Pay To',
    'value' => 'TestPayTo'
);
$payvia_info[] = array(
    'field' => 'Address',
    'value' => 'Riga, Latvia'
);

$data = array(
    'loginid' => 1,
    'payvia_type_id' => '1',
    'payvia_info' => $payvia_info
);

$url = 'http://domain/api/affiliate/setpayviainfo';

$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);
//dumps an associative array representation of the json
var_dump(json_decode($resp, true));
// Close request to clear up some resources
curl_close($curl);
?>