AffiliateSummit

API Documentation


API Overview

Magnet 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.

How Its Work

The Magnet API allows developers to integrate its database into their applications, enabling their users to access thousands of coupons and discounts.

Authentication

Magnet Magnet uses HTTP BASIC Auth for authenticating the API calls. The API key could be got from 'Your API Keys' page under integration tab in the web client console. You can manage your API keys from your account. Your API keys carry many privileges, so be sure to keep them secret.

1. Login to your Magnet software.
2. Go to My profile >> API Acces
3. If api filed is blank so click to generate api key and generate your api key.

The API keys are different for your test site and your live site.you should remember that you should never expose your secret API key in any public website's client-side code.

Resources

Magnet follows the REST model of exposing resources as URLs. For example

http://couponndeal/api/index.php
  • Request
  • Response
  • Sample Code

Request

All operations specific to that resource are exposed. The methods accept the input params as an array. You could also pass the environment configuration specific to that request as an additional parameter.

Response

The response is in JSON format. JSON will be returned in all responses from the API, including errors (though if you're using API bindings, we will convert the response to the appropriate language-specific object).

Sample Code

Your code like:
$param = array( "apiKey"=>"abcd123", "password"=>"123", "module"=>"employee", "action"=>"get", "id"=>"1" );
genereated response
{"id":"1", "group_id":"1", "user_type":"employee", "title":"Employee", "fname":"Nobal", "lname":"Ghosle", "email":"ng@alphainfolab.com", "password":"202cb962ac59075b964b07152d234b70", "status":"Active", }

API Actions

Action :
  • get : You can retrieve data from using the get method
  • add : You can add data from using the add method
  • update : You can modify your added data from update method

API Module

Admin :
  • store
  • category
  • coupon
  • deal
  • locate
  • banner
  • custom_pages
  • group
  • employee
  • advertiser
  • client
Advertiser :
  • profile
  • store
  • coupon

API Parameters

Parameters :
  • message : A descriptive information about the action happened
  • status : this is show what is the status of your message like, error, warning, success etc.
  • inserted_id : If we perform an add action,so we can get the ID of the last inserted record immediately.

Required Variables*


>>For Admin Panel ues api key as "apiKey", and password as "password"
>>For Advertiser panel use api key as "advapikey", and password as "advpassword"
>>More Parameter: Also Use these Parameters While Updating. But its not required.
>> * : Required Parameter.
>> status : status's first word should we capital at the time of add or update. Like Active, Pending, Deleted, Suspended
>> id : you can use get / delete method with more than one id or a single . For single id you can use : "id"=> 2, OR for multiple ids you can use : "id"=>("1,2,3")

Admin

Module get* add* update* More Parameter
store id name, status s_id name, status
category id name, status ca_id name, status
location id name, status l_id name, status
coupon id title, name, s_id, ca_id, l_id, type, status, link id title, name, s_id, ca_id, l_id, type { deal | copycode | sign_in}, status, link
deal deal_id text, status, title, start_at , expire_at { start_at and expire_at Format example : 2015-06-23 12:45:46 } deal_id text, status, title, start_at , expire_at { start_at and expire_at Format example : 2015-06-23 12:45:46 }
custom_page id name, title, fb_thumbnail, status, visibility { public | private } id name, title, fb_thumbnail, status, visibility { public | private }
banner id name, status, relative_type { home,stores | locate | category | coupon | cms_pages } id name, status, relative_type { home,stores | locate | category | coupon | cms_pages }
group group_id, group_type name, group_type, status group_id, group_type name, group_type, status
employee id,user_type fname, lname, email, password, status, group_id id, user_type fname, lname, email, password, status, group_id
advertiser id,user_type fname, lname, email, password, status, group_id id, user_type fname, lname, email, password, status, group_id
client id fname, lname, email, password, status id fname, lname, email, password, status
Example of admin console

Request : add
$param = array("apiKey"=>"abcd123", "password"=>"123", "module"=>"coupon", "action"=>"add" , "title"=>"coupon-title", "name"=>"A- coupon", "s_id"=>"1", "ca_id"=>"1", "l_id"=>"1", "type"=>"deal", "status"=>"Active", "link"=> "www.google.com" );
Response :
{
"status":"Success",
"message":"Added Successfully",
"inserted_id":2076
}

Request : update
$param = array("apiKey"=>"abcd123", "password"=>"123","module"=>"coupon", "action"=>"update" , "title"=>"coupon-title", "name"=>"A- coupon", "s_id"=>"1", "ca_id"=>"1", "l_id"=>"1", "type"=>"deal", "status"=>"Active", "link"=> "www.google.com", "id"=>2076 );
Response:
{
"status":"Success",
"message":"Updated Successfully"
}

Request : get
$param = array( "apiKey"=>"abcd123", "password"=>"123" "module"=>"coupon", "action"=>"get" , "id"=>603 );
Response :
{
"c_id":"603",
"owner_id":"3",
"owner_type":"admin",
"s_id":"0,44,0",
"ca_id":"0,84,83,0",
"l_id":"0,34,0",
"title":"Men's Casual Shoes Starts at Rs. 499",
"name":"Men's Casual Shoes Starts at Rs. 499",
"slug":"mens-casual-shoes-starts-at-rs.-299",
"meta_title":"%%name%%",
"meta_key":"%%keywords%%",
"meta_desc":"%%description%%",
"small_desc":"", "description":"Men's Casual Shoes at Yepme. Categories : Men’s Footwear Brands : Yepme Product : Shoes
Validity : Limited Period ",
"type":"deal",
"featured":"1",
"featured_image":null,"image":"shoes1431932214.jpg",
"status":"Active",
}

Advertiser

Module add* update* More Parameter
store name, status s_id name, status
coupon title, name, s_id, ca_id, l_id, type, status, link id title, name, s_id, ca_id, l_id, type, status, link
profile ----- id fname, lname, email, skype
Example of advertiser console

Request: add
$param = array( "module"=>"coupon", "action"=>"add" , "title"=>"coupon-2", "name"=>"b- coupon", "s_id"=>"1", "ca_id"=>"1", "l_id"=>"1", "type"=>"deal", "status"=>"Active", "link"=> "www.google.com", "advapiKey"=>"abcd123", "advpassword"=>"123" , );
Response : $param = array( "module"=>"coupon", "action"=>"update" , "title"=>"coupon-api", "name"=>"API- coupon", "s_id"=>"1", "ca_id"=>"1", "l_id"=>"1", "type"=>"deal", "status"=>"Active", "link"=> "www.google.com", "advapiKey"=>"abcd123", "advpassword"=>"123" , "id"=>2077 );
{
"status":"Success",
"message":"Added Successfully",
"inserted_id":2077
}

Request : update
$param = array( "module"=>"coupon", "action"=>"update" , "title"=>"coupon-api", "name"=>"API- coupon", "s_id"=>"1", "ca_id"=>"1", "l_id"=>"1", "type"=>"deal", "status"=>"Active", "link"=> "www.google.com", "advapiKey"=>"abcd123", "advpassword"=>"123" , "id"=>2077 );

Response :
{
"status":"Success",
"message":"Updated Successfully "
}


About US

Coupons and deals are becoming more and more important in the modern age of eCommerce, comparison shopping and uncertain economic times. Affiliate programs allow website owners to pick and choose coupons and deals to post to their websites and turn their website traffic into constant earnings. [...]

OUR MISSION

Our company aims to provide customers with the best products at the lowest price. Our goal is to bring eBusiness to another new level, enabling our customers to start their own online business with ease and generate an extra stream of revenue[...]

GET IN TOUCH WITH US!