Skip to content

Add Affiliate

POST /affiliate/addaffiliate

Description URL Response Format Request Method Authentication
Add affiliate via API https://domain/api/affiliate/addaffiliate JSON POST HTTP headers

Parameters

Paremeters must be sent with the request body. The examples below show the parameters sent as x-www-form-urlencoded

Name Description Type Required
username Id of affiliate to edit string yes
password Affiliate Password string yes
payvia Payvia type id of the payvia type to use with this affiliate integer yes
payvia_info Field/value pair arrays of payvia information to be set. Define 'payvia' to indicate which payvia type it applies to array no
email ID of the account status for this affiliate integer yes
firstname string no
lastname string no
company string no
url string no
tel string no
icq string no
aim string no
msn string no
skype string no
address1 affiliate address line 1 string no
address2 affiliate address line 2 string no
city affiliate city string no
state affiliate state string no
country affiliate country string no
zip_code affiliate zip code string no
minimum_payout Threshold for generating affiliate payouts. string no
join_ip string no
status affiliate state integer no
custom1 An additional custom value to store with this affiliate. (255 characters max) string no
custom2 An additional custom value to store with this affiliate. (255 characters max) string no
custom3 An additional custom value to store with this affiliate. (255 characters max) string no
custom4 An additional custom value to store with this affiliate. (255 characters max) string no
custom5 An additional custom value to store with this affiliate. (255 characters max) string no

Note

Possible values for status parameter are:

  • 0 - Active
  • 1 - Disabled
  • 2 - Banned
  • 3 - Wait on Verify
  • 4 - Pending
  • 5 - Denied

Example Request

POST

http://domain/api/affiliate/add_affiliate
username = hello
password = apitest
firstname = hello
lastname = test
email = hello@trackfinity.com
company = Trackfinity
url = trackfinity.com
tel = 666-666-6666
icq = 666666666
aim = sixsixsix
msn = sixsixtysix
address1 = 666 666 st
address2 = 
city = My City
state = My State
country = USA
zip_code = 12345
tax_id_or_ssn = 54-1233245
ref = asdasd
minimum_payout = 50
join_ip = 192.168.1.1
payvia=1

Response:

[
    {
        "result": true,
        "loginid": "10"
    }
]

Example Code

php

<?php
$curl = curl_init();

$data = array(
    'username' => 'hello',
    'password' => 'apitest',
    'firstname' => 'hello',
    'lastname' => 'test',
    'email' => 'hello@trackfinity.com',
    'company' => 'Trackfinity',
    'url' => 'trackfinity.com',
    'tel' => '666-666-6666',
    'icq' => '666666666',
    'aim' => 'sixsixsix',
    'msn' => 'sixsixtysix',
    'address1' => '666 666 st',
    'address2' => '',
    'city' => 'My City',
    'state' => 'My State',
    'country' => 'USA',
    'zip_code' => '12345',
    'tax_id_or_ssn' => '54-1233245',
    'ref' => 'asdasd',
    'minimum_payout' => 50,
    'join_ip' => '192.168.1.1',
    'payvia' => '1', // Check payvia type
    // notice the structure is an array of sub-arrays that have field/value pairs
    'payvia_info' => Array(
        Array(
            'field' => 'Pay To',
            'value' => 'Affiliate PayTo Name',
        ),
        Array(
            'field' => 'Address',
            'value' => 'Affiliate Address',
        ),
    ),
);

$url = 'http://domain/api/affiliate/addaffiliate';

$headers = array(
    'api-key: 44b5498dbcb481a0d00b404c0169af62',
    'api-username: productsupport'
);

curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));

$resp = curl_exec($curl);
//dumps an associative array representation of the json response
$output = json_decode($resp, true);
if($output !== NULL) {
    //json was valid. Dump the decoded array
    print_r($output);
}
else {
    //invalid json, just dump the raw response
    print_r($resp);
}
// Close request to clear up some resources
curl_close($curl);
?>
?>