API Bulk Import Adtools

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 now supports an API function that allows you to import bulk adtools. This lets you insert your custom adtools into the NATS tools through an automated process by running a cron that calls the bulk import API for your adtools import. This function sends all the standard information for the bulk importer (the dump, what the separator and fields are, etc.) so NATS can process the imported adtools as normal for the bulk importer.

Function Arguments

The API function to import bulk adtools is called import_adtools_dump. The arguments for this function are as follows:

  • adtool_type -- the numeric id of the type (for FHGs, it's 2)
  • dump -- the actual adtool dump
  • fields -- an array of the fields that are in the dump
  • separator -- the string that separates each of the fields in the dump
  • line_ending -- the string that separates the lines in the dump ('none' or mean that a line ending itself is the separator)
  • type -- the subtype of the adtool (the type field on the adtool)
  • enabled_on -- the siteid it should be enabled on. -1 means no sites. 0 means all sites.
  • publish_date -- the date you want it published. Can be anything you would put in to the field in the adtools admin the recommended format is YYYY-mm-dd (eg. 2010-01-31)
  • default_group -- the adtool group that you want this to be added to
  • ignore_dupes -- if set, instead of returning an error if a row has a duplicate to a unique field for an existing adtool, we'll instead just ignore the row.

If the importing worked correctly, the response will start with TRUE. If it didn't, it will start with FALSE, followed by the error.

Our NATS4 API article contains example code for using API functions, which you can build off of when implementing our bulk import adtools API. The following is an example of some code you can use to call the API function:

$dump = 'http://www.google.com/hatz|hats|morehats'."\n";
$dump .= 'http://www.google.com/bags2|bags2|some bags';
$fields = Array('url','name','description');

// Call the SOAP method
$values = array(
'adtool_type' => 2,
'dump' => $dump,
'fields' => $fields,
'separator' => '|',
'line_ending' => '',
'type' => 1,
'enabled_on' => 1,
'publish_date' => '2010-01-28',
'default_group' => 1000,
'ignore_dupes' => 1
);

$result = $client->call('import_adtools_dump', $values, 'natsapiadmin_wsdl');