API Documentation

11:52Document
1) CONNECT API ======================================================
Request URL : http://dev.protect4less.com/api/shopify/connect
Method: Post

Request JSON :
{
   "partner_code":"YOUR_PARTNER_CODE",
   "partner_key":"YOUR_API_KEY"
}
Successful Authentication Response JSON

{
   "status" : "success"
}
Unsuccessful Authentication Response JSON

{
   "status" : "error",
   "reason" : "INVALID_API_DEATILS",
   "message" : "Failed to authenticate code or key was invalid"
}

2) REGISTRATION API ======================================================
Request URL : http://dev.protect4less.com/api/shopify/register
Method: Post

Request JSON :
{
   "company_name":"Test",
   "busines_person_name":"First Last",
   "busines_email":"test@gmail.com",
   "busines_mobile":"9892198921",
   "business_website":"test.com",
   "entity_formation_year":"2000",
   "last_12_months_turnover":"2 million",
   "approx_units_sold_3_months":"300",
   "excepted_monthly_sales_of_p4l_plan":"150",
   "country":[
      {
	"country_id":"1",
	"country_code_2digit":"AE",
	"country_name":"UAE",
      }  
   ],
   "category":[
      {
	"name":"Laptops",
	"ID":"1",
      },
      {
	"name":"Mobile Phone",
	"ID":"2",

      },
      {
	"name":"Smart Watch",
	"ID":"3",
      },
      {
	"name":"Apperal",
	"ID":"4",
      }

   ]

}
Successful Authentication Response JSON

{
   "status" : "success"
}
Unsuccessful Authentication Response JSON

{
   "status":"error",
   "erroes":[
      {
         "reason":"FEILD_BLANK",
         "message":"business_website is blank"
      },
      {
         "reason":"FEILD_BLANK",
         "message":"entity_formation_year is blank"
      }
   ]
}

3) CATEGORY WARRANTIES API =======================================================
Request URL : http://dev.protect4less.com/api/shopify/get_category_warranty
Method: POST

Request Json
{

   "partner_code":"YOUR_PARTNER_CODE",
   "country":"UAE",
   "country_id":"1"
}
Successful Response JSON

 {
    "status": "success",
    "warranty": {
        "country": "UAE",
        "warranty": [
            {
                "8": {
                    "warranty-type": "AD",
                    "warranty-status": "ON",
                    "category": {
                        "2": {
                            "name": "Laptops",
                            "ID": 2,
                            "term-plan": {
                                "56": {
                                    "plan_code": "PAD12M",
                                    "name": "12 months AD",
                                    "p4l_premium": "12 months AD",
                                    "status": "1"
                                },
                                "57": {
                                    "plan_code": "PAD24M",
                                    "name": "24 months AD",
                                    "p4l_premium": "24 months AD",
                                    "status": "1"
                                },
                                "58": {
                                    "plan_code": "PAD36M",
                                    "name": "36 months AD",
                                    "p4l_premium": "36 months AD",
                                    "status": "1"
                                }
                            }
                        },
                        "3": {
                            "name": "Mobile Phone",
                            "ID": 3,
                            "term-plan": {
                                "56": {
                                    "plan_code": "PAD12M",
                                    "name": "12 months AD",
                                    "p4l_premium": "12 months AD",
                                    "status": "1"
                                },
                                "57": {
                                    "plan_code": "PAD24M",
                                    "name": "24 months AD",
                                    "p4l_premium": "24 months AD",
                                    "status": "1"
                                },
                                "58": {
                                    "plan_code": "PAD36M",
                                    "name": "36 months AD",
                                    "p4l_premium": "36 months AD",
                                    "status": "1"
                                }
                            }
                        },
                        "4": {
                            "name": "Smart Watch",
                            "ID": 4,
                            "term-plan": {
                                "56": {
                                    "plan_code": "PAD12M",
                                    "name": "12 months AD",
                                    "p4l_premium": "12 months AD",
                                    "status": "1"
                                },
                                "57": {
                                    "plan_code": "PAD24M",
                                    "name": "24 months AD",
                                    "p4l_premium": "24 months AD",
                                    "status": "1"
                                },
                                "58": {
                                    "plan_code": "PAD36M",
                                    "name": "36 months AD",
                                    "p4l_premium": "36 months AD",
                                    "status": "1"
                                }
                            }
                        },
                        "5": {
                            "name": "Apperal",
                            "ID": 5,
                            "term-plan": {
                                "56": {
                                    "plan_code": "PAD12M",
                                    "name": "12 months AD",
                                    "p4l_premium": "12 months AD",
                                    "status": "1"
                                },
                                "57": {
                                    "plan_code": "PAD24M",
                                    "name": "24 months AD",
                                    "p4l_premium": "24 months AD",
                                    "status": "1"
                                },
                                "58": {
                                    "plan_code": "PAD36M",
                                    "name": "36 months AD",
                                    "p4l_premium": "36 months AD",
                                    "status": "1"
                                }
                            }
                        }
                    }
                },
                "9": {
                    "warranty-type": "EW",
                    "warranty-status": "ON",
                    "category": {
                        "2": {
                            "name": "Laptops",
                            "ID": 2,
                            "term-plan": {
                                "59": {
                                    "plan_code": "PEW12M",
                                    "name": "12 months EW",
                                    "p4l_premium": "12 months EW",
                                    "status": "1"
                                },
                                "60": {
                                    "plan_code": "PEW24M",
                                    "name": "24 months EW",
                                    "p4l_premium": "24 months EW",
                                    "status": "1"
                                }
                            }
                        },
                        "3": {
                            "name": "Mobile Phone",
                            "ID": 3,
                            "term-plan": {
                                "59": {
                                    "plan_code": "PEW12M",
                                    "name": "12 months EW",
                                    "p4l_premium": "12 months EW",
                                    "status": "1"
                                },
                                "60": {
                                    "plan_code": "PEW24M",
                                    "name": "24 months EW",
                                    "p4l_premium": "24 months EW",
                                    "status": "1"
                                }
                            }
                        },
                        "4": {
                            "name": "Smart Watch",
                            "ID": 4,
                            "term-plan": {
                                "59": {
                                    "plan_code": "PEW12M",
                                    "name": "12 months EW",
                                    "p4l_premium": "12 months EW",
                                    "status": "1"
                                },
                                "60": {
                                    "plan_code": "PEW24M",
                                    "name": "24 months EW",
                                    "p4l_premium": "24 months EW",
                                    "status": "1"
                                }
                            }
                        },
                        "5": {
                            "name": "Apperal",
                            "ID": 5,
                            "term-plan": {
                                "59": {
                                    "plan_code": "PEW12M",
                                    "name": "12 months EW",
                                    "p4l_premium": "12 months EW",
                                    "status": "1"
                                },
                                "60": {
                                    "plan_code": "PEW24M",
                                    "name": "24 months EW",
                                    "p4l_premium": "24 months EW",
                                    "status": "1"
                                }
                            }
                        }
                    }
                }
            }
        ]
    }
}
Unsuccessful Response JSON

{
   "warranty":{
      "status":"error",
      "message":"CUSTOMIZE_MESSAGE"
   }
}

4) CATEGORY WARRANTIES EDIT API =======================================================
Request URL : http://dev.protect4less.com/api/shopify/warranty-category-edit
Method: Post

Request Json :

{    
    "partner_code": "YOUR_PARTNER_CODE",
    "country": "UAE",
    "country_id": "1",
    "term-plan": [
        {           
	    "1": {
		"status": "0"
	    },
	    "2": {
		"status": "0"
	    },
	    "3": {
		"status": "0"
	    }
	    "15": {
		"status": "1"
	    }
	    "16": {
		"status": "0"
	    }
	    "18": {
		"status": "1"
	    }
	    "20": {
		"status": "1"
	    }
        }
    ]
}
Successful Response JSON

{
	"status": "success",
	"message" : "Category Laptop,Mobile, Smart Watch has been updated successfully"
    
}
Unsuccessful Response JSON

{
     "status" : "error",
     "message" : "CUSTOMIZE_MESSAGE"         
}

5) PRODUCT WARRANTIES EDIT API =======================================================
Request URL : http://dev.protect4less.com/api/shopify/warranty-product
Method: Post

Request Json

{
   "partner_code":"YOUR_PARTNER_CODE",   
   "country_code_2digit":"AE",
   "country_id":"1", 
   "country":"UAE",
   "products":[
      {
         "product_id":"1",
         "product_name":"Lenovo 1",
	 "category_id":"1",
	 "category_name":"Laptop",
         "warranty":[
            {
               "warranty-type":"EW",
	       "warranty-name":"Extended Warranty",
               "term-plan":[
                  {
                     "plan_code":"PEW12M",
                     "name":"12 months EW",
                     "p4l_premium":"1.5",
                     "partner_margin":"1.1",
                     "status":"1"
                  },
                  {
                     "plan_code":"PEW24M",
                     "name":"24 months EW",
                     "p4l_premium":"1.5",
                     "partner_margin":"1.1",
                     "status":"0"
                  }
               ]
            },
            {
               "warranty-type":"AD",
	       "warranty-name":"Accidental Damage",
               "term-plan":[
                  {
                     "plan_code":"PAD12M",
                     "name":"12 months AD",
                     "p4l_premium":"1.5",
                     "partner_margin":"1.1",
                     "status":"1"
                  },
                  {
                     "plan_code":"PAD24M",
                     "name":"24 months AD",
                     "p4l_premium":"1.5",
                     "partner_margin":"1.1",
                     "status":"1"
                  },
                  {
                     "plan_code":"PAD36M",
                     "name":"36 months AD",
                     "p4l_premium":"1.5",
                     "partner_margin":"1.1",
                     "status":"0"
                  }
               ]
            }
         ]
      },
      {
         "product_id":"2",
         "product_name":"Lenovo 2",
	 "category_id":"1",
	 "category_name":"Laptop",
         "warranty":[
            {
               "warranty-type":"EW",
	       "warranty-name":"Extended Warranty",
               "term-plan":[
                  {
                     "plan_code":"PEW12M",
                     "name":"12 months EW",
                     "p4l_premium":"1.5",
                     "partner_margin":"1.1",
                     "status":"0"
                  },
                  {
                     "plan_code":"PEW24M",
                     "name":"24 months EW",
                     "p4l_premium":"1.5",
                     "partner_margin":"1.1",
                     "status":"1"
                  }
               ]
            },
            {
               "warranty-type":"AD",
	       "warranty-name":"Accidental Damage",
               "term-plan":[
                  {
                     "plan_code":"PAD12M",
                     "name":"12 months AD",
                     "p4l_premium":"1.5",
                     "partner_margin":"1.1",
                     "status":"0"
                  },
                  {
                     "plan_code":"PAD24M",
                     "name":"24 months AD",
                     "p4l_premium":"1.5",
                     "partner_margin":"1.1",
                     "status":"1"
                  },
                  {
                     "plan_code":"PAD36M",
                     "name":"36 months AD",
                     "p4l_premium":"1.5",
                     "partner_margin":"1.1",
                     "status":"1"
                  }
               ]
            }
         ]
      }
   ]
}
Successful Response JSON

{
	"status": "success",
	"message" : "Product PRODUCT_NAME has been updated."
    
}
Unsuccessful Response JSON

{

     "status" : "error",
     "message" : "CUSTOMIZE_MESSAGE"
         
}

6) FRONTEND CONFGURATION EDIT API =======================================================
Request URL : http://dev.protect4less.com/api/shopify/frontend
Method: Post

Request Json

{
   "partner_code":"YOUR_PARTNER_CODE",
   "layout":"laiout_1",
   "button_shape":"rounded",
   "button_text_color":"#000000",
   "button_bg_color":"#000000",
   "button_bg_hover":"#000000"
}

Successful Response JSON

{
	"status": "success",
	"message" : "Configuration has been successfully saved."
    
}
Unsuccessful Response JSON

{

     "status" : "error",
     "message" : "CUSTOMIZE_MESSAGE"
         
}