NATS4 API Get Affiliate Nats Codes

From TMMwiki
Jump to: navigation, search
NATS 4
SOAP API
API
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
REST API PATH UPDATES
GET /adtools/types
GET /adtools/categories
GET /adtools/admin
POST /adtools/importdump
GET /affiliate/hitdata
GET /affiliate/campaigns
GET /affiliate/payout
GET /affiliate/searchinfo
POST /affiliate/addaffiliate
PATCH /affiliate/setcustoms
PATCH /affiliate/setinformation
PATCH /affiliate/setadminsettings
PATCH /affiliate/setpayviainfo
PATCH /affiliate/setdefaults
PATCH /affiliate/setsettings
GET /decodenatscode
GET /member/upsellstring
GET /member/tokenrebuystring
GET /member/instantupgradestring
GET /member/packageupgradestring
GET /member/details
GET /member/cancelstring
GET /member/signupplusstring
GET /member/searchinfo
POST /member/addnote
POST /member/recordlogin
PUT /member/expiremanual
PATCH /member/setdetails
PATCH /member/setexpiration
GET /option/getrule
POST /option/addrule
PUT /option/edittext
PATCH /option/editrule
GET /payments/getpayments
PATCH /payments/setstatus
GET /payviarule
PATCH /payviarule
GET /ping
GET /profitlossreport
POST /sendemail
GET /suggestedcanceloffers

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.