Difference between revisions of "NATS4 API Admin Get Adtools"
From TMM Wiki
Jump to navigationJump to search(6 intermediate revisions by 4 users not shown) | |||
Line 2: | Line 2: | ||
| show_api_admin_section = true | | show_api_admin_section = true | ||
}} | }} | ||
+ | |||
+ | [[NATS4]] supports an API function to place and call adtool functions on your site; this function is called admin_get_adtools. | ||
+ | |||
admin_get_adtools accepts the following parameters: | admin_get_adtools accepts the following parameters: | ||
− | |||
− | |||
− | |||
− | |||
− | + | * '''natscode''' - Input your NATS code here. This specifies the loginid, campaignid, programid, siteid, and tourid used for the adtool. This is used when deciding what adtools are available, as well as what link code to use. You can build your own NATS code using an unencoded structure - please refer to this article about [[NATS4_Affiliate_Link_Codes#Unencoded_Link_Codes|Unencoded Link Codes]]. | |
− | + | ||
− | + | * '''siteid''' - This gives you the option to override the siteid that already exists in the NATS code. This parameter is optional; if you do not want to override your siteid, input '''0''' to disable it. | |
− | + | ||
− | + | * '''adtool_type_id''' - The adtool type to get adtools for (see the ([[NATS4_API_Adtool_Types|Adtool Types function]]) | |
− | + | ||
− | + | * '''params''' - A serialized array of parameters. See [[Nats_display_adtools|nats_display_adtools]] for the available parameters (you can use category, typeid, start, count, order, searchinline, and the search fields) | |
− | + | ||
− | + | ||
− | + | == NuSOAP Example == | |
− | |||
− | |||
− | |||
− | |||
− | + | This example continues from the [[NATS4_API#Example|main article NuSOAP Example]]: | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<pre> | <pre> | ||
$params = Array( | $params = Array( | ||
Line 83: | Line 26: | ||
); | ); | ||
$values = array( | $values = array( | ||
− | 'natscode'=>' | + | 'natscode'=>'DemoAff.1.2.3.4.5.0.0.6', |
'adtool_type_id'=>2, | 'adtool_type_id'=>2, | ||
'params' => serialize($params) | 'params' => serialize($params) | ||
Line 93: | Line 36: | ||
print_r($result); | print_r($result); | ||
</pre> | </pre> | ||
− | Output | + | |
+ | == Adtools Output == | ||
+ | |||
<pre> | <pre> | ||
Array | Array | ||
Line 105: | Line 50: | ||
[published_date] => 1246852800 | [published_date] => 1246852800 | ||
[trackurl] => http://nats.site.com/gallery/MC4xLjEuMS4wLjEwLjAuMC4w | [trackurl] => http://nats.site.com/gallery/MC4xLjEuMS4wLjEwLjAuMC4w | ||
− | [natscode] => | + | [natscode] => DemoAff.1.2.3.4.5.0.0.6 |
[extra] => Array | [extra] => Array | ||
( | ( | ||
Line 139: | Line 84: | ||
[published_date] => 1246852800 | [published_date] => 1246852800 | ||
[trackurl] => http://nats.site.com/gallery/MC4xLjEuMS4wLjExLjAuMC4w | [trackurl] => http://nats.site.com/gallery/MC4xLjEuMS4wLjExLjAuMC4w | ||
− | [natscode] => | + | [natscode] => DemoAff.1.2.3.4.5.0.0.6 |
[extra] => Array | [extra] => Array | ||
( | ( | ||
Line 173: | Line 118: | ||
[published_date] => 1246852800 | [published_date] => 1246852800 | ||
[trackurl] => http://nats.site.com/gallery/MC4xLjEuMS4wLjEyLjAuMC4w | [trackurl] => http://nats.site.com/gallery/MC4xLjEuMS4wLjEyLjAuMC4w | ||
− | [natscode] => | + | [natscode] => DemoAff.1.2.3.4.5.0.0.6 |
[extra] => Array | [extra] => Array | ||
( | ( | ||
Line 207: | Line 152: | ||
[published_date] => 1246852800 | [published_date] => 1246852800 | ||
[trackurl] => http://nats.site.com/gallery/MC4xLjEuMS4wLjEzLjAuMC4w | [trackurl] => http://nats.site.com/gallery/MC4xLjEuMS4wLjEzLjAuMC4w | ||
− | [natscode] => | + | [natscode] => DemoAff.1.2.3.4.5.0.0.6 |
[extra] => Array | [extra] => Array | ||
( | ( | ||
Line 235: | Line 180: | ||
) | ) | ||
</pre> | </pre> | ||
+ | |||
+ | [[Category:NATS4 API Articles]] |
Latest revision as of 13:46, 20 February 2013
NATS4 supports an API function to place and call adtool functions on your site; this function is called admin_get_adtools.
admin_get_adtools accepts the following parameters:
- natscode - Input your NATS code here. This specifies the loginid, campaignid, programid, siteid, and tourid used for the adtool. This is used when deciding what adtools are available, as well as what link code to use. You can build your own NATS code using an unencoded structure - please refer to this article about Unencoded Link Codes.
- siteid - This gives you the option to override the siteid that already exists in the NATS code. This parameter is optional; if you do not want to override your siteid, input 0 to disable it.
- adtool_type_id - The adtool type to get adtools for (see the (Adtool Types function)
- params - A serialized array of parameters. See nats_display_adtools for the available parameters (you can use category, typeid, start, count, order, searchinline, and the search fields)
NuSOAP Example
This example continues from the main article NuSOAP Example:
$params = Array( 'searchinline' => 1, 'search_type' => '5:1' ); $values = array( 'natscode'=>'DemoAff.1.2.3.4.5.0.0.6', 'adtool_type_id'=>2, 'params' => serialize($params) ); $result = $client->call('admin_get_adtools', $values, 'natsapiadmin_wsdl'); if($result) foreach($result as $key => $adtool){ if($adtool['extra']) $result[$key]['extra'] = unserialize($adtool['extra']); } print_r($result);
Adtools Output
Array ( [0] => Array ( [adtoolid] => 10 [name] => HATS [url] => http://www.google.com/hats [date_added] => 1246909656 [published_date] => 1246852800 [trackurl] => http://nats.site.com/gallery/MC4xLjEuMS4wLjEwLjAuMC4w [natscode] => DemoAff.1.2.3.4.5.0.0.6 [extra] => Array ( [networkid] => 0 [adtool_type_id] => 2 [deleted] => 0 [byo_owner] => 0 [byo_owner_only] => 0 [byo_program] => 0 [type] => 1 [items] => 0 [description] => Lots of hats [thumbnail] => [thumb_ext] => [var_divide] => ? [ids] => Array ( [loginid] => 1 [programid] => 1 [siteid] => 1 ) ) ) [1] => Array ( [adtoolid] => 11 [name] => bags [url] => http://www.google.com/bags [date_added] => 1246909656 [published_date] => 1246852800 [trackurl] => http://nats.site.com/gallery/MC4xLjEuMS4wLjExLjAuMC4w [natscode] => DemoAff.1.2.3.4.5.0.0.6 [extra] => Array ( [networkid] => 0 [adtool_type_id] => 2 [deleted] => 0 [byo_owner] => 0 [byo_owner_only] => 0 [byo_program] => 0 [type] => 1 [items] => 0 [description] => Lots of bags [thumbnail] => [thumb_ext] => [var_divide] => ? [ids] => Array ( [loginid] => 1 [programid] => 1 [siteid] => 1 ) ) ) [2] => Array ( [adtoolid] => 12 [name] => gowns [url] => http://www.google.com/gowns [date_added] => 1246909656 [published_date] => 1246852800 [trackurl] => http://nats.site.com/gallery/MC4xLjEuMS4wLjEyLjAuMC4w [natscode] => DemoAff.1.2.3.4.5.0.0.6 [extra] => Array ( [networkid] => 0 [adtool_type_id] => 2 [deleted] => 0 [byo_owner] => 0 [byo_owner_only] => 0 [byo_program] => 0 [type] => 1 [items] => 0 [description] => Lots of gowns [thumbnail] => [thumb_ext] => [var_divide] => ? [ids] => Array ( [loginid] => 1 [programid] => 1 [siteid] => 1 ) ) ) [3] => Array ( [adtoolid] => 13 [name] => shirts [url] => http://www.google.com/shirts [date_added] => 1246909656 [published_date] => 1246852800 [trackurl] => http://nats.site.com/gallery/MC4xLjEuMS4wLjEzLjAuMC4w [natscode] => DemoAff.1.2.3.4.5.0.0.6 [extra] => Array ( [networkid] => 0 [adtool_type_id] => 2 [deleted] => 0 [byo_owner] => 0 [byo_owner_only] => 0 [byo_program] => 0 [type] => 1 [items] => 0 [description] => Lots of shirts [thumbnail] => [thumb_ext] => [var_divide] => ? [ids] => Array ( [loginid] => 1 [programid] => 1 [siteid] => 1 ) ) ) )