Warning: include(): open_basedir restriction in effect. File(/storage/content/72/101772/rabatta.se/public_html/inc/config.php) is not within the allowed path(s): (/storage/content/20/2015120/api.rabatta.se/:/storage/configuration/wrappers/20/2015120/api.rabatta.se/:/tmp/) in /storage/content/20/2015120/api.rabatta.se/public_html/inc/init.php on line 2 Warning: include(/storage/content/72/101772/rabatta.se/public_html/inc/config.php): failed to open stream: Operation not permitted in /storage/content/20/2015120/api.rabatta.se/public_html/inc/init.php on line 2 Warning: include(): Failed opening '/storage/content/72/101772/rabatta.se/public_html/inc/config.php' for inclusion (include_path='.:/usr/local/php72/lib/php:/storage/content/20/2015120/pear/php') in /storage/content/20/2015120/api.rabatta.se/public_html/inc/init.php on line 2 Warning: Use of undefined constant SITE_CONFIG_DIRECTORY - assumed 'SITE_CONFIG_DIRECTORY' (this will throw an Error in a future version of PHP) in /storage/content/20/2015120/api.rabatta.se/public_html/inc/init.php on line 3 Warning: include(SITE_CONFIG_DIRECTORY/inc/language/sv_SE.php): failed to open stream: No such file or directory in /storage/content/20/2015120/api.rabatta.se/public_html/inc/init.php on line 3 Warning: include(): Failed opening 'SITE_CONFIG_DIRECTORY/inc/language/sv_SE.php' for inclusion (include_path='.:/usr/local/php72/lib/php:/storage/content/20/2015120/pear/php') in /storage/content/20/2015120/api.rabatta.se/public_html/inc/init.php on line 3 Warning: Use of undefined constant SITE_CONFIG_DIRECTORY - assumed 'SITE_CONFIG_DIRECTORY' (this will throw an Error in a future version of PHP) in /storage/content/20/2015120/api.rabatta.se/public_html/inc/init.php on line 4 Warning: include(SITE_CONFIG_DIRECTORY/inc/func.php): failed to open stream: No such file or directory in /storage/content/20/2015120/api.rabatta.se/public_html/inc/init.php on line 4 Warning: include(): Failed opening 'SITE_CONFIG_DIRECTORY/inc/func.php' for inclusion (include_path='.:/usr/local/php72/lib/php:/storage/content/20/2015120/pear/php') in /storage/content/20/2015120/api.rabatta.se/public_html/inc/init.php on line 4 Warning: Use of undefined constant SITE_CONFIG_DIRECTORY - assumed 'SITE_CONFIG_DIRECTORY' (this will throw an Error in a future version of PHP) in /storage/content/20/2015120/api.rabatta.se/public_html/inc/init.php on line 5 Warning: include(SITE_CONFIG_DIRECTORY/inc/dbconn.php): failed to open stream: No such file or directory in /storage/content/20/2015120/api.rabatta.se/public_html/inc/init.php on line 5 Warning: include(): Failed opening 'SITE_CONFIG_DIRECTORY/inc/dbconn.php' for inclusion (include_path='.:/usr/local/php72/lib/php:/storage/content/20/2015120/pear/php') in /storage/content/20/2015120/api.rabatta.se/public_html/inc/init.php on line 5 Warning: Use of undefined constant SITE_CONFIG_DIRECTORY - assumed 'SITE_CONFIG_DIRECTORY' (this will throw an Error in a future version of PHP) in /storage/content/20/2015120/api.rabatta.se/public_html/inc/init.php on line 6 Warning: include(SITE_CONFIG_DIRECTORY/inc/class/class.coupons.add.php): failed to open stream: No such file or directory in /storage/content/20/2015120/api.rabatta.se/public_html/inc/init.php on line 6 Warning: include(): Failed opening 'SITE_CONFIG_DIRECTORY/inc/class/class.coupons.add.php' for inclusion (include_path='.:/usr/local/php72/lib/php:/storage/content/20/2015120/pear/php') in /storage/content/20/2015120/api.rabatta.se/public_html/inc/init.php on line 6 Warning: Use of undefined constant SITE_CONFIG_DIRECTORY - assumed 'SITE_CONFIG_DIRECTORY' (this will throw an Error in a future version of PHP) in /storage/content/20/2015120/api.rabatta.se/public_html/index.php on line 8 Warning: include(SITE_CONFIG_DIRECTORYinc/html/header.php): failed to open stream: No such file or directory in /storage/content/20/2015120/api.rabatta.se/public_html/index.php on line 8 Warning: include(): Failed opening 'SITE_CONFIG_DIRECTORYinc/html/header.php' for inclusion (include_path='.:/usr/local/php72/lib/php:/storage/content/20/2015120/pear/php') in /storage/content/20/2015120/api.rabatta.se/public_html/index.php on line 8

Rabatta API Beta

Rabatta API är tillgängligt för icke-kommersiell användning. För kommersiella licenser kontakta oss för vidare information. Rabattkoder dvs fältet coupon_code visas ej i den icke-kommersiella versionen.

Överblick

All kommunikation sker via HTTP. Förfrågningar kan returneras i antingen JSON eller XML. Vårt rabattkod API bygger på REST.

I dagsläget använder vi inga API-nycklar, detta kommer dock troligen att ändras inom snar framtid. Hanteringen av nycklar kommer då att skötas via Storeowner.

Lägg till rabattkod

Lägga till en ny rabattkod i systemet. Alla textfält ska vara url-kodade. Tillgängliga parametrar är:

coupon_code required

Själva rabattkoden

store_url required

Adressen till hemsidan för butiken, om ni är osäkra på vad som gäller för specifik butik kan ni kolla mot vårt butikindex. Vi tillåter ej underkataloger som t.ex www.butik.se/webshop

coupon_description required

Kort beskrivning av vad rabattkoden ger, t.ex "100kr rabatt vid köp över 300kr"

coupon_description_long optional

Speciella villkor som gäller för rabattkoden, uteslutna produkter etc

coupon_date_expire optional

Utgångsdatumet för rabattkoden, t.ex "2013-04-30"

coupon_submitter optional

Namnet på personen som tipsat om koden

 

Exempel

POST: http://api.
Warning: Use of undefined constant SITE_DOMAIN_NAME - assumed 'SITE_DOMAIN_NAME' (this will throw an Error in a future version of PHP) in /storage/content/20/2015120/api.rabatta.se/public_html/index.php on line 54
SITE_DOMAIN_NAME/api/coupons/new.json
POST Data: coupon_code=frifrakt2013&store_url=www.butik.se&coupon_description=100kr+rabatt+vid+k%C3%B6p+%C3%B6ver+300kr&coupon_date_expire=2013-04-30
---
{
  "result_status": "ok",
  "coupon_id": 123456,
  "coupon_status": 2
}

Hämta senaste rabattkoder

Listar de 20 senaste tillagda rabattkoderna. Exemplet nedan är bestyckat till 5.

Exempel

$ curl http://api.rabatta.se/api/coupons/latest.json
---
{
   "0":{
      "coupon":{
         "store_name":"Vitapost.se",
         "store_url":"www.vitapost.se",
         "coupon_id":"7247",
         "coupon_code":"",
         "coupon_description":"Fri frakt",
         "coupon_date":"1360313162",
         "coupon_expire":"1360796400",
         "coupon_success":"100"
      }
   },
   "1":{
      "coupon":{
         "store_name":"Lekmer",
         "store_url":"www.lekmer.se",
         "coupon_id":"7246",
         "coupon_code":"",
         "coupon_description":"10% rabatt",
         "coupon_date":"1360272988",
         "coupon_expire":"0",
         "coupon_success":"100"
      }
   },
   "2":{
      "coupon":{
         "store_name":"Ellos",
         "store_url":"www.ellos.se",
         "coupon_id":"7243",
         "coupon_code":"",
         "coupon_description":"30% rabatt p\u00e5 r\u00f6da varor (g\u00e4ller \u00e4ven varum\u00e4rken)",
         "coupon_date":"1360272540",
         "coupon_expire":"1360450800",
         "coupon_success":"100"
      }
   },
   "3":{
      "coupon":{
         "store_name":"TomTom",
         "store_url":"www.tomtom.com",
         "coupon_id":"7245",
         "coupon_code":"",
         "coupon_description":"20% rabatt p\u00e5 Nike SportWatch GPS black\/anthracite",
         "coupon_date":"1360272540",
         "coupon_expire":"0",
         "coupon_success":"100"
      }
   },
   "4":{
      "coupon":{
         "store_name":"Boxerfy",
         "store_url":"www.boxerfy.com",
         "coupon_id":"7240",
         "coupon_code":"",
         "coupon_description":"20% rabatt f\u00f6r nya kunder",
         "coupon_date":"1360251801",
         "coupon_expire":"1364684400",
         "coupon_success":"100"
      }
   }
}

Hämta rabattkoder ur kategori

Listar de 20 senaste rabattkoderna från vald kategori. Exemplet nedan är bestyckat till 1.

Exempel

$ curl http://api.rabatta.se/api/coupons/category/3.json
---
{
   "0":{
      "coupon": {
         "store_name": "Sportamore",
         "store_url": "www.sportamore.se",
         "store_url_local": "http://www.rabatta.se/rabattkod/sportamore",
         "store_logo_url": "http://img.rabatta.se/img/logos/130x57/www_sportamore_se.gif",
         "store_logo_bgcolor": "ffffff",
         "store_category_id": "3",
         "store_category_name": "Kläder & Mode",
         "coupon_id": "18081",
         "coupon_code": "",
         "coupon_description": "15% rabatt på ordinarie priser",
         "coupon_date": "1428569635",
         "coupon_expire": "1430344800",
         "coupon_success": "100",
         "coupon_analyze_discount_value": "0",
         "coupon_analyze_criteria_value": "0",
         "coupon_analyze_discount_percentage": "15",
         "coupon_analyze_specific_product": "1"
      }
   }
}

Hämta rabattkod

Returnerar information för rabattkod specificerad av :id

Exempel

$ curl http://api.rabatta.se/api/coupons/id/7247.json
---
{
   "0":{
      "store_name":"Vitapost.se",
      "store_url":"www.vitapost.se",
      "coupon_id":"7247",
      "coupon_code":"",
      "coupon_description":"Fri frakt",
      "coupon_date":"1360313162",
      "coupon_expire":"1360796400",
      "coupon_success":"100"
   }
}
Warning: Use of undefined constant SITE_CONFIG_DIRECTORY - assumed 'SITE_CONFIG_DIRECTORY' (this will throw an Error in a future version of PHP) in /storage/content/20/2015120/api.rabatta.se/public_html/index.php on line 223 Warning: include(SITE_CONFIG_DIRECTORYinc/html/footer.php): failed to open stream: No such file or directory in /storage/content/20/2015120/api.rabatta.se/public_html/index.php on line 223 Warning: include(): Failed opening 'SITE_CONFIG_DIRECTORYinc/html/footer.php' for inclusion (include_path='.:/usr/local/php72/lib/php:/storage/content/20/2015120/pear/php') in /storage/content/20/2015120/api.rabatta.se/public_html/index.php on line 223