Omnistar Affiliate Software User Guide

1. Introduction


The XML API functionality use to insert affiliate users and delete affiliate users to a users group remotely.

2. System Requirements


For using the XML API functionality server must be running PHP 5.1.2 or higher with cURL support.


3. Submitting a Request


For using the XML API functionality you can submit the request through cURL with valid XML format. The XML Path will look similar to the following:

http://www.yourdomain.com/affiliate/xml.php


Following are the sample for using the XML API functionality:


a) For Add Affiliate Users:


    <?php

    $content = '<?xml version="1.0"?>

    <xmlrequest>

    <username>admin</username>

    <usertoken>21232f297a57a5a743894a0e4a801fc3</usertoken>

    <requestmethod>InsertAffiliate</requestmethod>

    <details>

    <usergroup>youruser group</usergroup>

    <referredby>email@domain.com</referredby>

    <affiliateprogram>affiliate program</affiliateprogram>

    <status>Approved</status>

    <customfields>

    <item>

    <fieldname>First Name:</fieldname>

    <value>your first name</value>

    </item>

    <item>

    <fieldname>Last Name:</fieldname>

    <value>your last name</value>

    </item>

    <item>

    <fieldname>Choose Password:</fieldname>

    <value>123456</value>

    </item>

    <item>

    <fieldname>Confirm Password:</fieldname>

    <value>123456</value>

    </item>

    <item>

    <fieldname>Email:</fieldname>

    <value>email@domain.com</value>

    </item>

    <item>

    <fieldname>Company:</fieldname>

    <value>synapseIndia</value>

    </item>

    </customfields>

    </details>

    </xmlrequest>';

    $ch = curl_init("http://www.yourdomain.com/affiliate/xml.php");

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    curl_setopt($ch, CURLOPT_POST, 1);

    curl_setopt($ch, CURLOPT_POSTFIELDS, "xml=$content");

    $result = @curl_exec($ch);

    if($result === false) {

    echo "Error performing request";

    }

    else {

    $xml_doc = simplexml_load_string($result);

    echo 'Status is ', $xml_doc->status, '<br/>';

    if ($xml_doc->status == 'SUCCESS') {

    echo 'Data is <br />', $xml_doc->data, '<br/>';

    } else {

    echo 'Error is <br />', $xml_doc->errormessage, '<br/>';

    }

    }
    curl_close($ch);

    ?>


    The XML document structure for Adding affiliate users:


    xmlrequest (Required) This is the root document tag name.
    username (Required) This is the admin user name.
    usertoken (Required) This is user token number like password for using the API. You can get it: by going to the "Manage Administrator" section under System Management. The API user token will look like this 4e127412e602d6826867cc3403b7caeb.
    requestmethod (Required) This is the method name for API, For adding the affiliate users method name is “InsertAffiliate”.
    details (Required) This is the details of affiliate users. If you want to add the more then one affiliate users at a time just repeat the details tag.
    usergroup (Optional) This is the users group
    referredby (Optional) This is the affiliate user email address which is refer.
    affiliateprogram (Optional) This is the affiliate program name to affiliate user has access.
    status (Required) It should be “Approved” or “Disabled”.
    customfields (Optional) This is the tag for custom field.
    item (Optional) If you want to add more than one custom fields just repeat the item tag.
    fieldname (Optional) This is custom field name for example “first name”
    value (Optional) This is the custom value for example “manish”.


    Note: We like to mention that need to be put the required field in the customfields.


    If successfully added the affiliates it will return the success message like Status is SUCCESS
    Data is armanish@sampatti.com added successfully.


b) For Delete affiliate users:


    <?php

    $content = '<?xml version="1.0"?>

    <xmlrequest>

    <username>admin</username>

    <usertoken>21232f297a57a5a743894a0e4a801fc3</usertoken>

    <requestmethod>DeleteAffiliate</requestmethod>

    <details>

    <email>email@domain.com</email>

    </details>

    <details>

    <email>another.email@domain.com</email>

    </details>

    </xmlrequest>';

    $ch = curl_init("http://www.yourdomain.com/affiliate/xml.php");

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    curl_setopt($ch, CURLOPT_POST, 1);

    curl_setopt($ch, CURLOPT_POSTFIELDS, "xml=$content");

    $result = @curl_exec($ch);

    if($result === false) {

    echo "Error performing request";

    }

    else {

    $xml_doc = simplexml_load_string($result);

    echo 'Status is ', $xml_doc->status, '<br/>';

    if ($xml_doc->status == 'SUCCESS') {

    echo 'Data is <br />', $xml_doc->data, '<br/>';

    } else {

    echo 'Error is <br />', $xml_doc->errormessage, '<br/>';

    }

    }

    curl_close($ch);

    ?>


    The XML document structure for deleting affiliate users:


    xmlrequest (Required) This is the root document tag name.
    username (Required) This is the admin user name.
    usertoken (Required) This is user token number like password for using the API. You can get it:by going to the "Manage Administrator" section under System Management. The API user token will look like this 4e127412e602d6826867cc3403b7caeb.
    requestmethod (Required) This is the method name for API, For deleting the affiliates users method name is “DeleteAffiliate”.
    details (Required) This is the details of affiliate users. If you want to delete the more then one affiliate users at a time just repeat the details tag.
    email (Required) This is the email address of affiliate users e.g which you want to delete.


    If successfully delete the affiliate users it will return the success message like Status is SUCCESS
    Data is armanish@sampatti.com deleted successfully.