NATS4 API Get Affiliate Nats Codes

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

NATS4 supports an API function to get an affiliate's NATS code for the passed in data.

get_affiliate_nats_codes accepts the following parameters:

  • loginid - The affiliate ID to encode the NATS code with. This parameter is required.
  • programid - The program ID to encode the NATS code with. This parameter is required.
  • siteid - The site ID to encode the NATS code with. If not passed in then NATS will grab the site ID based on the tour ID passed in.
  • tourid - The tour ID to encode the NATS code with. If not passed in then NATS will grab all the tours for a site.
  • campaignid - The affiliate's campaign ID to encode the NATS code with. If not passed in or an invalid campaign ID is passed in then NATS will default the campaign ID to 0 (the default campaign).
  • adtoolid - The adtool ID to encode the NATS code with. If not passed in or an invalid adtool ID is passed in then NATS will default the adtool ID to 0.
  • subid1 - The subid1 ID to encode the NATS code with.
  • subid2 - The subid2 ID to encode the NATS code with.
  • promotionalid - The promotional ID to encode the NATS code with.
  • link_style - The desired NATS code style to return. Possible values are: unencoded, shortname or encoded. encoded is the default.

NuSOAP Example

This example continues from the main article NuSOAP Example):

$params = Array(
	'loginid' => '2',
	'programid' => '1',
	'siteid' => '3',
	'tourid' => '0',
	'campaignid' => '1',
	'adtoolid' => '2',
	'subid1' => '0',
	'subid2' => '0',
	'promotionalid' => '0',
	'link_style' => 'shortname',
);

$result = $client->call('get_affiliate_nats_codes', $params, 'natsapiadmin_wsdl');

print_r($result);

Affiliate Campaign Data Output

The output will be an array. The array's index of 'result' will be either SUCCESS or ERROR with an error message. If successful then the array's 'return' index will be populated. This will contain the site/tour information with the affiliate's NATS code.

Array
(
    [result] => SUCCESS
    [return] => Array
        (
            [0] => Array
                (
                    [siteid] => 3
                    [site_name] => Mem Test
                    [tourid] => 6
                    [tour_name] => Default Tour
                    [track_url] => http://msopko.nats4.jager.toomuchmedia.com/track/TMMMikeS.Temp.AMtest.MAIN.1.2.0.0.0
                    [nats_code] => TMMMikeS.Temp.AMtest.MAIN.1.2.0.0.0
                )

            [1] => Array
                (
                    [siteid] => 3
                    [site_name] => Mem Test
                    [tourid] => 7
                    [tour_name] => New Tour - Mem Test
                    [track_url] => http://msopko.nats4.jager.toomuchmedia.com/track/TMMMikeS.Temp.AMtest.AWESOME_MEM_TEST.1.2.0.0.0
                    [nats_code] => TMMMikeS.Temp.AMtest.AWESOME_MEM_TEST.1.2.0.0.0
                )

            [2] => Array
                (
                    [siteid] => 3
                    [site_name] => Mem Test
                    [tourid] => 15
                    [tour_name] => New Tour - MobileTest
                    [track_url] => http://msopko.nats4.jager.toomuchmedia.com/track/TMMMikeS.Temp.AMtest.MobileTest.1.2.0.0.0
                    [nats_code] => TMMMikeS.Temp.AMtest.MobileTest.1.2.0.0.0
                )

            [3] => Array
                (
                    [siteid] => 3
                    [site_name] => Mem Test
                    [tourid] => 20
                    [tour_name] => New Tour - TestNewTour
                    [track_url] => http://msopko.nats4.jager.toomuchmedia.com/track/TMMMikeS.Temp.AMtest.TestNewTour.1.2.0.0.0
                    [nats_code] => TMMMikeS.Temp.AMtest.TestNewTour.1.2.0.0.0
                )

            [4] => Array
                (
                    [siteid] => 3
                    [site_name] => Mem Test
                    [tourid] => 23
                    [tour_name] => aaasdas
                    [track_url] => http://msopko.nats4.jager.toomuchmedia.com/track/TMMMikeS.Temp.AMtest.aaasdas.1.2.0.0.0
                    [nats_code] => TMMMikeS.Temp.AMtest.aaasdas.1.2.0.0.0
                )
        )
)

Affiliate Campaign Errors Output

The following are the possible errors returned from this API call:

  • ERROR: Bad loginid - The login ID passed in does not exist within NATS.
  • ERROR: Bad programid - The program ID passed in does not exist within NATS.
  • ERROR: tour does not belong to site - The tour ID passed in does not belong to the site ID passed in.
  • ERROR: Bad siteid and tourid - The tour ID and site ID passed in does not exist within NATS.