Pulling data from flipkart using flipkart api. The initial release with simple FlipkartApi class to get categories, products in perticular category, deals of the day, top offers in json format. On version 0.1.0, the support is added for delta products and flipkart api version number can be configured while instializing the object (v0.1.0/v1.1.0).
Api Requests are sent using rest-client gem.
require 'flipkart_api' fk_api = FlipkartApi.new(Fk-Affiliate-Id, Fk-Affiliate-Token, "v0.1.0") categories = fk_api.get_categories(format) #Format: json/xml, Returns the response from server: json/xml rest_url = fk_api.get_category_porducts_api(category_name) #Name is as present in the categories products = fk_api.get_products_by_category(category_name) #Name is as present in categories (xml/json). Returns upto first 500 products in JSON parsed data structure products = fk_api.get_all_products(rest_url) #Url is the one retured by get_categories/get_category_products_api. This method will get all the products in JSON parsed data structure products = fk_api.get_products(rest_url) #Url is the one returned by get_categories/get_category_products_api. Returns upto 500 products from the given rest api in JSON parsed data structure product = fk_api.get_product_by_id(product_id) #id assigned by flipkart for a product. delta_api = fk_api.get_category_delta_version_api(category_name) delta_version = fk_api.get_current_delta_version(delta_api) delta_version_api = fk_api.get_category_delta_products_api(category_name) delta_products = fk_api.get_delta_products_by_category(category_name) books_categories = fk_api.get_book_categories("json") books_categoriy_api = fk_api.get_category_books_api(categories) #categories type is array (hierachy means 'Cildren Books' is sub group of 'Fiction & No-Fiction Books') and format is '["Books", "Fiction & Non-Fiction Books", "Children Books", "Activity Books", "Cursive Writing"]' # This method will return api of 'Cursive Writing' category. books = fk_api.get_books_by_category(categories) dotd= fp_api.get_dotd_offers(format) #to get deals of the day. format = xml/json top_offers = fp_api.get_topoffers(format) search = fp_api.search("key", format, no_records) # To search products. format= xml/json, no_records = 10 (10 is the max value and its optional) orders_report = fp_api.orders_report(start_date, end_date, status) # To get orders report. parameters: start_date = "yyyy-mm-dd" end_date = "yyyy-mm-dd" status = Pending/Approved/Cancelled/Disapproved
<img src=“https://badge.fury.io/rb/flipkart_api.svg” alt=“Gem Version” />
<img src=“https://travis-ci.org/deepakhb2/flipkart_api.svg?branch=master” />
Released under the [MIT License](www.opensource.org/licenses/MIT).