Api user guide

You are in the right place, if you are looking for help. If you are getting started then you can download documentation of "Silk Route - The Ultimate Affiliate Program" from here. There are following documents prepared by our expert to help you using Garuda more efficiently.

API USER GUIDE DOCUMENTATION


API Overview

Have you ever wondered how programs on your computer and the websites you visit “talk” to each other? To understand that, we first have to delve into the weird and wonderful world of APIs, or Application Programing Interfaces.

The phrase API appears regularly in computer-science fields. But what does it mean? Well, definitively put, it refers to a tool, or library, that assists developers in writing code that interfaces with other software. These can range from the low-level tools that allow Windows and OS X applications to use aspects of the underlying operating system, to those powering the apps on your phone. In short, it defines a way in which a computer program communicates with another computer program.

But APIs aren’t inherently interesting. The application of these tools is what really matters. Here’s how APIs are making the web awesome, opening up governments, and increasing consumer choice.

Silk Route provides HTTP based API. The HTTP protocol's rules are followed thereby enabling simple HTTP client tools like "curl" to be used. Our API is designed to have predictable, resource-oriented URLs and to use HTTP response codes to indicate API errors. We use built-in HTTP features, like HTTP authentication and HTTP verbs, which can be understood by off-the-shelf HTTP clients.

Requirments

  • In order to use the API, your network must be on the Enterprise pricing plan or a Dedicated solution.
  • All requests require an API Key, which is a randomly generated string unique to your network.
  • IP address making request must have been submitted to the white-list for API access.
  • Additionally, all requests require your Network ID.

Authentication

Allow users to enter their API key and password in order to obtain a API which allows Users to fetch a specific records - without using their API key and password. Once their API key has been obtained, the user can offer the API key - which offers access to a specific resource for a time period - to the remote site

Attention: The API secret key is very essential. You Should never be expose it on public website's.

Creating an API Key

  • API keys can be created from within the application
  • Log into the application
  • Click on 'Account' menu and go to 'My Profile'
  • Click on Setting Tab and manage API Key
  • You can also talk to your Account Manager about creating and obtaining your API Key

Making Request

Your API Key and Password are used to authenticate requests through the API. Every API request must have a valid API Key and password combination. When making an API Request, use your API Key value for the NetworkToken parameter, and your Password for the password parameter.

Request URL:
http://< Your Domail Name >/api/index.php
Sample Request Code :
$con_arr = array(
     0 => 'and',
     '1' => array(
          "0" => 'status',
          "1" => 'Active'
          )
     );


$para = array(
     "user_apiKey" => "--Your API Key--",
     "user_password" => "***Password***",
     "responce_language" => 'eng',
     "userType" => 'publisher',
     "action" => 'get_users',
     "condition_arr" => $con_arr
);

Sample Response:

{
 "status":"Success",
 "message":[{
       "id":"211",
       "comp_id":"199",
       "type":"advertiser",
       "title":"Mr ",
       "f_name":"Manoj",
       "l_name":"Kumar",
       "email":"mka@alphainfolab.com",
       "phone":"91-101010101010",
       "office_phone":"+91 731 4081111",
       "status":"Active",
       "timezone":"Pacific\/Honolulu",
       "display_lang":"eng",
       "permissions":"{\"stats\":\"1\",\"offer_mgt\":\"1\",\"user_mgt\":\"1\",\"acc_mgt\":\"1\",\"creative_mgt\":\"1\"}",
      },
      {
       "id":"236",
       "comp_id":"199",
       "type":"advertiser",
       "title":"Mr",
       "f_name":"Deependra",
       "l_name":"Kumar",
       "email":"deepak25790@gmail.com",
       "phone":"+91-9654106024",
       "office_phone":"+91 731 4081111",
       "status":"Active",
       "timezone":"Pacific\/Marquesas",
       "display_lang":"eng",
       "permissions":"{\"stats\":\"1\",\"offer_mgt\":\"1\",\"user_mgt\":\"1\",\"acc_mgt\":\"1\",\"creative_mgt\":\"1\"}",
      }]
 }

Common variables

These all variables are required for every call of API

  • user_apiKey : It holds API Key
  • user_password : Password of user
  • userType : It could be 'network, advertiser, publisher'
  • module : It is only required for admin api (when you use userType `network` )
  • action : It hold action as describe as bello tables
  • responce_language " In which language you wants responce of API (It is not required, by default responce language is 'english')
  • eng : English - Default
  • chi : Chinese (Simplified) - 中文(简体
  • cze : Czech - Český
  • dut : Dutch - Nederlands
  • fre : French - Français
  • deu : German - Deutsch
  • heb : Hebrew - עִבְרִית
  • ita : Italian - Italiano
  • por : Portuguese - Português
  • rum : Romanian - Română
  • rus : Russian - Русский
  • spa : Spanish - Español
  • swe : Swedish - Svenska
  • tur : Turkish - Türkçe

Admin Variable Table

module* action* required variables* Other / Optional variables
networkGroup addEmployeeGroup status | group_title | permissions --
networkGroup updateEmployeeGroup id title | status | permissions
networkGroup getEmployeeGroup id (You can give multiple saperated by comma(,)) --
networkGroup deleteEmployeeGroup id (You can give multiple saperated by comma(,)) --
network addEmployee name | group_id | email | password title
network updateEmployee id email | emp_group | title | name | office_phone | skype_id | country_code | phone | photo_url
network deleteEmployee id (You can give multiple saperated by comma(,)) --
network getEmployee id (You can give multiple saperated by comma(,)) --
publisher addPublisher country_code | mobile_number | company_name | aff_city | aff_country | aff_state | aff_zip_code | aff_email | aff_account_manager | status | first_name | last_name | password address_2 | address_3 | title
publisher updatePublisher id company_name | address_1 | address_2 | address_3 | aff_city | aff_state | aff_country | aff_zip_code | aff_account_manager | status | reference_id
publisher deletePublisher id (You can give multiple saperated by comma(,)) --
publisher getPublisher condition_array --
publisher get_user condition_array --
publisher user_create company_id | first_name | last_name | email | phone_code | phone_no | password | status title | office_phone
publisher update_user id title_name | first_name | last_name | aff_email | phone_code | phone_no | status |
publisher user_delete id (You can give multiple saperated by comma(,)) --
advertiser getAdvertiser condition_array --
advertiser addAdvertiser company_name | add1 | city | state | country | zipcode | phone_code | email | first_name | last_name | password | status add2 | add3 | title
advertiser updateAdvertiser id company_name | add1 | city | state | country | zipcode | phone_code | phone_no | status
advertiser deleteAdvertiser id (You can give multiple saperated by comma(,)) --
advertiser user_get condition_array --
advertiser user_create company_id | first_name | last_name | email | password | status title | phone_code | phone_no | Office_phone
advertiser user_update id company_id | first_name | last_name | email | status | phone_code | phone_no
advertiser user_delete id (You can give multiple saperated by comma(,)) --
offer getOfferCategory condition_array --
offer addOfferCategory name | status --
offer updateOfferCategory id name | status
offer deleteOfferCategory id (You can give multiple saperated by comma(,)) --
offer getOffer condition_array --
offer addOffer advertiser | name | preview_url | default_url | conversion_tracking | status | categories | expiration_date custom_currency | currency_offer | set_private | conversion_goal | set_require_approve | terms_condition | caps | daily_conversion | multiple_conversion | daily_payout | monthly_payout | daily_revenue | monthly_revenue | email_instuction | approve_from_line | tracking_domain | direct_link | website_link | offer_approve_con | offer_multi_con | offerstart_sess_tracck | offer_encrypt_conv_tracking | custom_variable
offer updateOffer id advertiser | name | preview_url | default_url | conversion_tracking | status | expiration_date | categories | reference_id | note | token | token_value |
offer deleteOffer id (You can give multiple saperated by comma(,)) --
offer getOfferGroup condition_arr --
offer addOfferGroup name | status --
offer updateOfferGroup id name | status
offer getOfferApplication condition_arr --
offer manageofferApplication id | Appstatus --
offer settingOffer id (offer ID) set_private | set_require_approve | caps | daily_con | monthly_conversion | daily_payout | monthly_payout | daily_revenue | monthly_revenue | terms_condition | additional_terms_condition | email_instuction | approve_from_line | approve_sub_lines | suppression_list | offer_display_advertisers | set_seo_friendly_links
offer approvePublisher publisher_id (publisher_id can be multiple saperated by comma(,)) | id (offer ID) --
offer unapprovePublisher publisher_id (publisher_id can be multiple saperated by comma(,)) | id (offer ID) --
offer blockPublisher publisher_id (publisher_id can be multiple saperated by comma(,)) | id (offer ID) --
offer blockPublisher publisher_id (publisher_id can be multiple saperated by comma(,)) | id (offer ID) --
offer getTinyUrl condition_arr --
offer addTinyUrl offer_id offer_url | preview_url
offer updateTinyUrl id name | offer_url | preview_url | status
offer deleteTinyUrl id --
offer getCreativeFile condition_arr --
offer addCreativeFile offer_id | type | overwrite | name status (Active, Pending) | private ( 1, 0) | filecontent | file_name
offer updateCreativeFile creative_id name | type | status | private | width | height | flash_var | code
campaign getCampaign condition_arr --
campaign addCampaign name | type | status | custom_weight | affiliate_access | optimization | optimization_type( if optimization = 1 ) width | height
campaign updateCampaign campaign_id name | type | width | height | status | custom_weight | optimization | optimization_type | affiliate_access

Clinet Side Variables (publisher)

Action REQUIRED VARIABLES* OTHER VARIABLES
add fname | lname | user_status | email | pass | phone_code | phone_no title | Office_phone
update_details user_id f_name | l_name | title | phone_code | phone_no | email | office_phone
update_settings user_id time_zone | enforce_ip | language | notification_email
update_account id company_name | address_1 | address_2 | address_3 | country | state | city | phone
add_campaign campaign_name | type | status | custom_weight | optimization | optimization_type (if optimization is '1') width | height
update_campaign campaign_id campaign_name | type | width | height | status | custom_weight | optimization | optimization_type
get_offers condition_arr --
get_campaign condition_arr --
get_creatives condition_arr --
add_creative_file offer_id | type | name filecontent | file_name (if you use filecontent 'file_name' is required)

Variable Help

Variable Description
permissions Permissions variable holds array of permissions That you can to enable (1) or disable (0).
Example:

$permissions = array("billing" => '1',"stats" => '1', "offer" => '1', "affiliate" => '1', "advertiser" => '1', "conversion" => '1', "virtual" => '1', "file" => '1', "campaign' => '1', "employee" => '1', "activity" => '1', "setting" => '1')

id You can request single or multiple ids Saperated by comma(,). Example: $id = '101' or $id = '101,102,103'
reference_id Assign a reference ID to this account and pass this value into Offer URLs. To know more about reference ID contact your Account Manager
condition_array

Condition Array is a two dimentional array in the first index of the array is the condition ( AND / OR ). Other index is array of field name and values by which you want to filter values.

$con_arr = array(
     "0" => 'AND',
     "1" => array(
          "0" => 'status',
          "1" => 'Active'
          )
     );
     "2" => array(
          "0" => 'id',
          "1" => '101,102,103'
          )
          ...
     );
advertiser (When action is addOffer) This variable will be hold id of advertiser. (only integer value)
categories (When action is addOffer) It is a array holds ids of categouries
conversion_tracking conversion tracking options are : http, https, http_img, https_img, server
expiration_date Expiration date will be in 'yyyy-mm-dd' format
Appstatus This variable only can hold 'approve, deny'
type Type may be : File, Image Banner, Flash Banner, HTML Ad, Text Link, Email Creative, Offer Thumbnail, Hidden Asset
overwrite If overwrite = 1, Overwrite existing file if one already exists with the same name. If you enter overwrite = 0, to overwrite the existing file, then the filename will be prepended with a timestamp. For example, abc.jpg => 10901840-abc.jpg
filecontent This varible will be hold, content of the file that you want to upload for creative. Example : "filecontent" => get_file_contents('your file name with path');

If you used filecontent than it compulsory to use 'file_name' too. `file_name` variable to hold the name of file.

payout_type It could be - 'cpa_flat, cpa_percentage, cpa_both, cpc, cpm'
location location is a array to hold multiple countries and them states. like- $location = array(
     "India" => array(
          "0" => 'Chhattisgarh',
          "1" => 'Dadra and Nagar Haveli'
          "1" => 'Delhi'
          "1" => 'Daman and Diu'
          )
     );
     "Afghanistan" => array(
          "0" => 'Badghis',
          "1" => 'Baghlan'
          "1" => 'Balkh'
          )
          ...
     );
optimization_type It could be - 'rpc, cr, rpm, ctr'