NATS4 API Get Affiliate Nats Codes
From TMM Wiki
Revision as of 15:59, 21 December 2012 by TMMMikeSopko (talk | contribs) (Created page with "{{NATS4 Manual | show_api_admin_section = true }} NATS4 supports an API function to get an affiliate's NATS code for the passed in data. get_affiliate_nats_codes accept...")
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.