Skip to content

Instantly share code, notes, and snippets.

@shivergard
Last active February 26, 2018 21:45
Show Gist options
  • Save shivergard/b3a2d95cf702a04ea8b6743151d3f2b6 to your computer and use it in GitHub Desktop.
Save shivergard/b3a2d95cf702a04ea8b6743151d3f2b6 to your computer and use it in GitHub Desktop.
API for Mobile Web apps

#exFoodyCheck API Documentation (for demo access and stuff please write some comment ;) )

Get Barcode Info

Returns json data about a single product.

  • URL

    /api/v1/get_barcode_info

  • Method:

    GET

  • URL Params

    Required:

    bar_code=[integer]

  • Data Params

    none

  • Success Response:

    • Code: 200
      Content: {"status":1,"bar_code":"4750075000813","product":{"image":"http:\/\/foodycheck.com\/storage\/maxima-product-list\/43f46793-325c-49ba-94c6-21a032d3ba0b.png","id":1511,"name":"Sald\u0113jums R\u016aJIENAS PLOMB\u012aRS 1l","brand":"R\u016aJIENA","description":"Sald\u0113jums R\u016aJIENAS plomb\u012brs 1l","public":0,"components_cleartext":"PIENS 40%, saldais KREJUMS 39%, cukurs, sausais V\u0100JPIENA pulveris, emulgators: tauksk\u0101bju monoglicer\u012bdi un diglicer\u012bdi, augu \u0161\u0137iedrvielas vani\u013cas aromatiz\u0113t\u0101js.","issuer_cleartext":null,"country":"Latvija","neto":"1 l","holding":null,"fat":"15","fatty_acids":"9","carbohydrates":"17.5","sugar":"7.5","fiber":null,"protein":"3.5","salt":"0.14 g","monounsaturated_fatty":null,"polyunsaturated_fatty":null,"polyols":null,"starch":null,"bar_code":"4750075000813","energetics":"219kcal\/912kJ","category_id":null,"rate":7,"categories":[1]}}
  • Error Response:

    • Code: 404 NOT FOUND
      Content: {"status":0,"bar_code":"009"}
  • Sample Call:

      $.ajax({
        url: "/api/v1/get_barcode_info?bar_code=4750075000813",
        dataType: "json",
        type : "GET",
        success : function(r) {
          console.log(r);
        }
      });

Get Categories

Returns json data about public product categories.

  • URL

    /api/v1/get_categories

  • Method:

    GET

  • URL Params

    none

  • Data Params

    none

  • Success Response:

    • Code: 200
      Content: {"data":[{"id":1,"name":"Sald\u0113jums","image":"http:\/\/foodycheck.com\/images\/ice_cream.png","created_at":"2017-07-25 12:01:34","updated_at":"2017-11-23 18:27:30","public":1},{"id":2,"name":"B\u0113rnu p\u0101rtika","image":"http:\/\/foodycheck.com\/images\/baby_food.png","created_at":"2017-07-25 12:01:34","updated_at":"2017-11-23 18:27:43","public":1},{"id":3,"name":"Dz\u0113rieni","image":"http:\/\/foodycheck.com\/images\/beverages.png","created_at":"2017-07-25 12:01:34","updated_at":"2017-11-23 18:27:58","public":1},{"id":4,"name":"Ga\u013cas produkti","image":"http:\/\/foodycheck.com\/images\/meats.png","created_at":"2017-07-25 12:01:34","updated_at":"2017-11-23 18:28:15","public":1},{"id":7,"name":"Graudaugi","image":"http:\/\/foodycheck.com\/images\/bakery.png","created_at":"2017-07-25 12:01:34","updated_at":"2017-07-25 12:01:34","public":1},{"id":8,"name":"Konservi","image":"http:\/\/foodycheck.com\/images\/canned_food.png","created_at":"2017-07-25 12:01:34","updated_at":"2017-11-23 18:28:32","public":1},{"id":9,"name":"Maizes produkti","image":"http:\/\/foodycheck.com\/images\/breads.png","created_at":"2017-07-25 12:01:34","updated_at":"2017-11-23 18:28:49","public":1},{"id":10,"name":"M\u0113rces","image":"http:\/\/foodycheck.com\/images\/sauces.png","created_at":"2017-07-25 12:01:34","updated_at":"2017-11-23 18:29:06","public":1},{"id":11,"name":"Piena produkti","image":"http:\/\/foodycheck.com\/images\/dairy.png","created_at":"2017-07-25 12:01:34","updated_at":"2017-11-23 18:29:18","public":1},{"id":13,"name":"Saldumi","image":"http:\/\/foodycheck.com\/images\/sweets.png","created_at":"2017-07-25 12:01:34","updated_at":"2017-11-23 18:29:32","public":1},{"id":14,"name":"Siers","image":"http:\/\/foodycheck.com\/images\/cheese.png","created_at":"2017-07-25 12:01:34","updated_at":"2017-11-23 18:29:46","public":1},{"id":15,"name":"Uzkodas","image":"http:\/\/foodycheck.com\/images\/snacks.png","created_at":"2017-07-25 12:01:34","updated_at":"2017-11-23 18:29:58","public":1},{"id":16,"name":"Zivis","image":"http:\/\/foodycheck.com\/images\/seafood.png","created_at":"2017-07-25 12:01:34","updated_at":"2017-11-23 18:30:09","public":1},{"id":17,"name":"\u017d\u0101v\u0113ti aug\u013ci un rieksti","image":"http:\/\/foodycheck.com\/images\/dried_fruits_and_nuts.png","created_at":"2017-07-25 12:01:34","updated_at":"2017-11-23 18:30:29","public":1},{"id":18,"name":"Olas un to izstr\u0101d\u0101jumi","image":"http:\/\/foodycheck.com\/images\/olas.png","created_at":"2017-11-22 22:00:00","updated_at":"2017-11-23 18:38:24","public":1},{"id":19,"name":"Aug\u013ci un d\u0101rze\u0146i","image":"http:\/\/foodycheck.com\/images\/augli-un-darzeni.png","created_at":"2017-11-22 22:00:00","updated_at":"2017-11-23 18:37:26","public":1},{"id":20,"name":"Cita p\u0101rtika","image":"http:\/\/foodycheck.com\/images\/cita-partika.png","created_at":"2017-11-22 22:00:00","updated_at":"2017-11-23 18:38:11","public":1},{"id":21,"name":"Pusfabrik\u0101ti","image":"http:\/\/foodycheck.com\/images\/pusfabrikaati.png","created_at":"2017-11-22 22:00:00","updated_at":"2017-11-23 18:38:35","public":1}]}
  • Error Response:

    • Code: 404 NOT FOUND
      Content: {"status":0 }
  • Sample Call:

      $.ajax({
        url: "/api/v1/get_categories",
        dataType: "json",
        type : "GET",
        success : function(r) {
          console.log(r);
        }
      });

    Get Products by Category


Returns json data about a products in categories.

  • URL

    /api/v1/get_products_by_category

  • Method:

    GET

  • URL Params

    Required:

    category_id=[integer]

    Optional:

    reduced=[integer] (as returned product limit)

  • Data Params

    none

  • Success Response:

    • Code: 200
      Content: {"current_page":1,"data":[{"bar_code":"4750075000813","name":"Sald\u0113jums R\u016aJIENAS PLOMB\u012aRS 1l","image":"http:\/\/foodycheck.com\/storage\/maxima-product-list\/43f46793-325c-49ba-94c6-21a032d3ba0b.png","description":"Sald\u0113jums R\u016aJIENAS plomb\u012brs 1l","rate":7,"is_favorite":0,"zen":null},{"bar_code":"8714100532942","name":"Sald\u0113jums SUPER VIVA vani\u013cas 180ml","image":"http:\/\/foodycheck.com\/storage\/maxima-product-list\/d1191859-9199-4c74-97c5-c509b7261f47.png","description":"Vani\u013cas plomb\u012bra sald\u0113jums vafe\u013cu konus\u0101","rate":6,"is_favorite":1,"zen":1},{"bar_code":"8714100533437","name":"Sald\u0113jums SUPER VIVA citr.\/apels. 200ml","image":"http:\/\/foodycheck.com\/storage\/maxima-product-list\/fc61c3a3-228a-42cf-b351-c73efd3bba61.png","description":"CITRONU UN APELS\u012aNU GAR\u0160AS SALD\u0112JUMS AR MARAKUJAS PILD\u012aJUMU, P\u0100RKL\u0100TS AR CITRONU GAR\u0160AS GLAZ\u016aRU, VAFE\u013bU GL\u0100Z\u012aT\u0112","rate":6,"is_favorite":0,"zen":null}],"from":1,"last_page":26,"next_page_url":"http:\/\/foodycheck.com\/api\/v1\/get_products_by_category?page=2","path":"http:\/\/foodycheck.com\/api\/v1\/get_products_by_category","per_page":"3","prev_page_url":null,"to":3,"total":76}
  • Error Response:

    • Code: 404 NOT FOUND
      Content: {"status":0}
  • Sample Call:

      $.ajax({
        url: "/api/v1/get_products_by_category?category_id=1&reduced=3",
        dataType: "json",
        type : "GET",
        success : function(r) {
          console.log(r);
        }
      });

    Product Search


Returns json data about a products searched.

  • URL

    /api/v1/search_product

  • Method:

    GET

  • URL Params

    Required:

    search=[string]

    category_id=[integer]

  • Data Params

    none

  • Success Response:

    • Code: 200
      Content: {"current_page":1,"data":[{"bar_code":"7622300679712","name":"BelVita pilngraudu cepumi 300g","image":"http:\/\/foodycheck.com\/storage\/maxima-product-list\/746d0266-c56a-42ff-8923-e9ded04ebc95.png","description":"PILNGRAUDU CEPUMI AR PIENU, BAG\u0100TIN\u0100TI AR DZELZI, MAGNIJU UN VITAM\u012aNIEM E Belvita 300g","rate":4,"is_favorite":0,"zen":null},{"bar_code":"7622300687755","name":"Belvita pilngr.cepumi ar me\u017ea og\u0101m 300g","image":"http:\/\/foodycheck.com\/storage\/maxima-product-list\/32fb2688-607b-4356-8419-800c3a29dd17.png","description":"PILNGRAUDU CEPUMI AR ME\u017dA OGU GABALI\u0145IEM UN BAG\u0100TIN\u0100TI AR VITAM\u012aNIEM Belvita 300g","rate":3,"is_favorite":0,"zen":null},{"bar_code":"7622300443320","name":"BelVita pilngr. cepumi ar laz.rieks.300g","image":"http:\/\/foodycheck.com\/storage\/maxima-product-list\/8bc21c97-695a-41cb-8d19-96f6b83e8936.png","description":"PILNGRAUDU CEPUMI AR LAZDU RIEKSTIEM UN MEDU, BAG\u0100TIN\u0100TI AR DZELZI, Belvita 300g","rate":2,"is_favorite":0,"zen":null},{"bar_code":"7622300443290","name":"BelVita pilngr. cep.laz.riek.un medu 50g","image":"http:\/\/foodycheck.com\/storage\/maxima-product-list\/0f019daa-5e67-44fe-8f4f-3831657588e7.png","description":"PILNGRAUDU CEPUMI AR LAZDU RIEKSTIEM UN MEDU, BAG\u0100TIN\u0100TI AR DZELZI, Belvita 50g","rate":2,"is_favorite":0,"zen":null},{"bar_code":"7622300443269","name":"BelVita kakao pilngr.cep.ar \u0161ok.gab.300g","image":"http:\/\/foodycheck.com\/storage\/maxima-product-list\/a2000ccf-14f6-4b1d-bbae-beffa29c8df0.png","description":"KAKAO PILNGRAUDU CEPUMI AR \u0160OKOL\u0100DES GABALI\u0145IEM, BAG\u0100TIN\u0100TI AR DZELZI, MAGNIJU UN VITAM\u012aNIEM E UN B1 Belvita 300g","rate":2,"is_favorite":0,"zen":null}],"from":1,"last_page":1,"next_page_url":null,"path":"http:\/\/foodycheck.com\/api\/v1\/search_product","per_page":100,"prev_page_url":null,"to":5,"total":5}
  • Error Response:

    • Code: 404 NOT FOUND
      Content: {"status":0}
  • Sample Call:

      $.ajax({
        url: "search_product?search=PILNGRAUDU CEPUMI AR",
        dataType: "json",
        type : "GET",
        success : function(r) {
          console.log(r);
        }
      });

List Favorites [UNSECURE]

Returns json data about a user favorite product.

  • URL

    /api/v1/get_favorites

  • Method:

    GET

  • URL Params

    Required:

    social_id=[integer]

  • Data Params

    none

  • Success Response:

    • Code: 200
      Content: {"current_page":1,"data":[{"bar_code":"54491472","name":"G\u0101z.dz\u0113r. COCA-COLA 500ml PET","image":"http:\/\/foodycheck.com\/storage\/maxima-product-list\/71f6aa08-9f86-4416-b371-d97a1bcf67df.png","description":"G\u0101z\u0113ts bezalkoholiskais dz\u0113riens ar kolas gar\u0161u.","rate":7,"is_favorite":1,"zen":1},{"bar_code":"4750058015100","name":"Sald\u0113jums DRUVA cigori\u0146u 130ml","image":"http:\/\/foodycheck.com\/storage\/maxima-product-list\/2c65922b-4dc9-46b5-b356-0599055c27ef.png","description":"Cigori\u0146u plomb\u012bra sald\u0113jums DRUVA 130ml","rate":6,"is_favorite":1,"zen":1},{"bar_code":"8714100532942","name":"Sald\u0113jums SUPER VIVA vani\u013cas 180ml","image":"http:\/\/foodycheck.com\/storage\/maxima-product-list\/d1191859-9199-4c74-97c5-c509b7261f47.png","description":"Vani\u013cas plomb\u012bra sald\u0113jums vafe\u013cu konus\u0101","rate":6,"is_favorite":1,"zen":1},{"bar_code":"4740574080669","name":"Vasa\u013cu salami asa 90g(NOO)","image":"http:\/\/foodycheck.com\/storage\/maxima-product-list\/2622067b-62b8-4e7d-8578-31408061756b.png","description":"K\u016bpin\u0101ta Vasa\u013cu salami ar melnajiem pipariem 90g","rate":null,"is_favorite":1,"zen":1}],"from":1,"last_page":1,"next_page_url":null,"path":"http:\/\/foodycheck.com\/api\/v1\/get_favorites","per_page":100,"prev_page_url":null,"to":4,"total":4}
  • Error Response:

    • Code: 404 NOT FOUND
      Content: {"status":0}
  • Sample Call:

      $.ajax({
        url: "get_favorites?social_id=1",
        dataType: "json",
        type : "GET",
        success : function(r) {
          console.log(r);
        }
      });

Add Favorites [UNSECURE]

Add favorite product by BarCode.

  • URL

    /api/v1/add_favorite

  • Method:

    GET

  • URL Params

    Required:

    social_id=[integer]

    bar_code=[integer]

  • Data Params

    none

  • Success Response:

    • Code: 200
      Content: {"status":1}
  • Error Response:

    • Code: 404 NOT FOUND
      Content: {"status":0}
  • Sample Call:

      $.ajax({
        url: "add_favorite?social_id=1&bar_code=1",
        dataType: "json",
        type : "GET",
        success : function(r) {
          console.log(r);
        }
      });

Remove Favorites [UNSECURE]

Remove favorite product by BarCode.

  • URL

    /api/v1/remove_favorite

  • Method:

    GET

  • URL Params

    Required:

    social_id=[integer]

    bar_code=[integer]

  • Data Params

    none

  • Success Response:

    • Code: 200
      Content: {"status":1}
  • Error Response:

    • Code: 404 NOT FOUND
      Content: {"status":0}
  • Sample Call:

      $.ajax({
        url: "remove_favorite?social_id=1&bar_code=1",
        dataType: "json",
        type : "GET",
        success : function(r) {
          console.log(r);
        }
      });

Upload product description images [UNSECURE]

Upload image

  • URL

    /api/v1/upload/:bar_code

  • Method:

    POST

  • URL Params

    Required:

    image=[base64_string]

  • Data Params

    none

  • Success Response:

    • Code: 200
      Content: {"status":1}
  • Error Response:

    • Code: 404 NOT FOUND

Last time Updated Categories

check categories last update time

  • URL

    /api/v1/last_update

  • Method:

    POST

  • URL Params

none

  • Data Params

    none

  • Success Response:

    • Code: 200
      Content: {"status":1 , "last_update":{"date":"2017-11-23 18:38:35.000000","timezone_type":3,"timezone":"UTC"}}
  • Error Response:

    • Code: 404 NOT FOUND

Generate Rating from Product Indigridients

Indigridient Rating and coifficent calculation

  • URL

    /api/v1/get_rating

  • Method:

    POST

  • URL Params

    Required:

    content=[string]

  • Data Params

    none

  • Success Response:

    • Code: 200
      Content: {"status":1,"rating":6 }
  • Error Response:

    • Code: 404 NOT FOUND

[BackendBackend Method !!] Get Failed Products

Get EAN codes of products , that was failed to find

  • URL

    /api/v1/falied_product_return

  • Method:

    POST

  • URL Params

    date=[string]

    limit=[integer]

    ip=[string]

  • Data Params

    none

  • Success Response:

    • Code: 200
      Content: {"status":0,"log_count":4,"access_logs":{"current_page":1,"data":[{"id":11,"ean":"4750142001712","ip":"198.211.122.181","success":0,"created_at":"2017-11-23 21:50:10","updated_at":"2017-11-23 21:50:10"},{"id":8,"ean":"a","ip":"198.211.122.181","success":0,"created_at":"2017-11-23 21:36:37","updated_at":"2017-11-23 21:36:37"},{"id":7,"ean":"a","ip":"109.110.15.177","success":0,"created_at":"2017-11-23 21:36:27","updated_at":"2017-11-23 21:36:27"},{"id":6,"ean":"9000100961172","ip":"198.211.122.181","success":0,"created_at":"2017-11-23 21:31:55","updated_at":"2017-11-23 21:31:55"}],"from":1,"last_page":1,"next_page_url":null,"path":"/api\/v1\/falied_product_return","per_page":10,"prev_page_url":null,"to":4,"total":4}}
  • Error Response:

    • Code: 404 NOT FOUND
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment