Example #1
0
 def get(self, model=None, id=None, **payload):
     ioc_name = model
     model = request.env[self._model].sudo().search(
         [('model', '=', model)], limit=1)
     if model:
         domain, fields, offset, limit, order = extract_arguments(
             payload)
         data = request.env[model.model].sudo().search_read(
             domain=domain, fields=['id', 'name', 'description', 'price', 'public_categ_ids'], offset=offset, limit=limit, order=order)
         if data:
             return valid_response(data)
         else:
             return valid_response(data)
     return invalid_response('invalid object model', 'The model %s is not available in the registry.' % ioc_name)
Example #2
0
    def stock(self, **payload):

        product = request.env['product.product'].sudo().browse(
            int(payload.get('product_id')))
        available_qty = product.qty_available

        # For specific warehouse / location:
        #available_qty = product.with_context({'warehouse': WAREHOUSE_ID}).qty_available
        #available_qty = product.with_context({'location': LOCATION_ID}).qty_available
        # Source: https://www.odoo.com/es_ES/forum/ayuda-1/question/how-to-get-product-quantity-109870

        return valid_response({'stock': available_qty})
Example #3
0
 def orders(self, **payload):
     user_data = request.env['res.users'].sudo().search_read(
         domain=[('id', '=', request.session.uid)],
         fields=['partner_id'],
         offset=None,
         limit=1,
         order=None
     )
     orders = request.env['sale.order'].sudo().search_read(
         domain=[
             ('partner_id', '=', user_data[0].get('partner_id')[0]),
             ('state', '=', 'sent'),
         ],
         fields=[
             'id',
             'state',
             #'date_order',
             'require_payment',
             #'create_date',
             #'confirmation_date',
             'amount_untaxed',
             'amount_tax',
             'amount_total',
             #'write_date',
         ],
         offset=None,
         limit=None,
         order='create_date DESC'
     )
     for order in orders:
         order['lines'] = request.env['sale.order.line'].sudo().search_read(
             domain=[('order_id', '=', order['id'])],
             fields=[
                 'id',
                 'name',
                 'invoice_status',
                 'price_unit',
                 'price_subtotal',
                 'price_tax',
                 'price_total',
                 'price_reduce',
                 'price_reduce_taxinc',
                 'price_reduce_taxexcl',
                 'discount',
                 'product_id',
                 'product_uom_qty',
             ],
             offset=None,
             limit=None,
             order='id ASC'
         )
     return valid_response(orders)
Example #4
0
 def log_out(self, **post):
     """."""
     _token = request.env['api.access_token']
     access_token = request.httprequest.headers.get('access_token')
     access_token = _token.search([('token', '=', access_token)])
     if not access_token:
         info = "No access token was provided in request!"
         error = 'no_access_token'
         _logger.error(info)
         return invalid_response(400, error, info)
     for token in access_token:
         token.unlink()
     # Successful response:
     return valid_response(
         200,
         {"desc": 'token successfully deleted', "delete": True}
     )
Example #5
0
 def reviews(self, **payload):
     return valid_response([])
Example #6
0
    def products(self, **payload):

        applied_filters = json.loads(payload.get('request')).get('_appliedFilters')

        # Search domain
        domain = []

        # Detect specific category
        requested_id = -1
        for applied_filter in applied_filters:
            if applied_filter.get('attribute') == "category_ids":
                ins = applied_filter.get('value').get('in')
                if len(ins) == 1:
                    slug = applied_filter.get('value').get('in')[0]
                    requested_id = int(slug.split("-")[-1]) - self.category_offset
        if requested_id != -1:
            domain = [('public_categ_ids', 'in', [requested_id])]

        # Detect specific product
        request_json = json.loads(payload.get('request'))
        applied_filters = request_json.get('_appliedFilters')
        applied_filter = applied_filters[0]
        if applied_filter.get('attribute') == "sku":
            sku = int(applied_filter.get('value').get('eq'))
            domain = [('id', '=', sku)]

        # Detect search
        request_json = json.loads(payload.get('request'))
        search_text = request_json.get('_searchText')
        if search_text:
            domain = [('name', 'ilike', search_text)]

        data = request.env['product.template'].sudo().search_read(
            domain=domain, fields=[
                'id',
                'name',
                'description',
                'list_price',
                'public_categ_ids',
                'default_code',
                'attribute_line_ids',
            ], offset=None, limit=None,
            order=None)
        if data:
            products = []
            for element in data:

                # Preparing data for "configurable_options"
                variants_array = []
                attribute_line_ids = element.get('attribute_line_ids')
                for attribute_line_id in attribute_line_ids:
                    variant = request.env['product.template.attribute.line'].sudo().search_read(
                        domain=[('id', '=', attribute_line_id)],
                        fields=['id', 'value_ids', 'attribute_id'],
                        offset=None,
                        limit=None,
                        order=None)[0]
                    value_ids = variant['value_ids']
                    variant['attributes'] = []
                    for value_id in value_ids:
                        attribute = request.env['product.attribute.value'].sudo().search_read(
                            domain=[('id', '=', value_id)],
                            fields=['name', 'html_color'],
                            offset=None,
                            limit=None,
                            order=None)
                        variant['attributes'].append(attribute)
                    variants_array.append(variant)

                # Preparing data for "configurable_children"
                # "product.attribute.value.product.product.rel" relates products with attribute values
                # find products for current template
                configurable_childrens = request.env['product.product'].sudo().search_read(
                    domain=[('product_tmpl_id', '=', element.get('id'))],
                    fields=['id', 'product_template_attribute_value_ids'],
                    offset=None,
                    limit=None,
                    order=None)
                configurable_children_array = []
                for configurable_children in configurable_childrens:

                    configurable_children['list_price'] = element.get('list_price')
                    configurable_children['attributes'] = []

                    value_ids = configurable_children['product_template_attribute_value_ids']
                    for value_id in value_ids:
                        attribute = request.env['product.attribute.value'].sudo().search_read(
                            domain=[('id', '=', value_id)],
                            fields=['id', 'name', 'attribute_id'],
                            offset=None,
                            limit=None,
                            order=None)
                        configurable_children['attributes'].append(attribute)

                    configurable_children_array.append(
                        configurable_children
                    )

                products.append(JSONTypes.productJSON(
                    element.get('name'),
                    element.get('id'),
                    element.get('default_code'),
                    element.get('list_price'),
                    element.get('attribute_line_ids'),
                    variants_array,
                    configurable_children_array,
                    self.size_attribute_name,
                    self.color_attribute_name,
                    self.host_odoo,
                ))
            print(products)
            return valid_response(products)
        else:
            # Response for no products found
            return valid_response([])
Example #7
0
 def attributes_json(self, **payload):
     attributes = []
     attributes.append(JSONTypes.attributeJSON(
         True,  # is_html_allowed_on_front
         False,  # used_for_sort_by
         False,  # is_used_in_grid
         False,  # is_filterable_in_grid
         [],  # apply_to
         "0",  # is_searchable
         "0",  # is_visible_in_advanced_search
         "1",  # is_used_for_promo_rules
         "0",  # used_in_product_listing
         145,  # attribute_id
         "erin_recommends",  # attribute_code
         "boolean",  # frontend_input
         False,  # is_required
         [
             {
                 "label": "Yes",
                 "value": "1"
             },
             {
                 "label": "No",
                 "value": "0"
             }
         ],  # options
         True,  # is_user_defined
         "Erin Recommends",  # default_frontend_label
         "int",  # backend_type
         "Magento\\Eav\\Model\\Entity\\Attribute\\Source\\Boolean",  # backend_model
         "Magento\\Eav\\Model\\Entity\\Attribute\\Source\\Boolean",  # source_model
         "",  # default_value
         145,  # id
     ))
     attributes.append(JSONTypes.attributeJSON(
         True,  # is_html_allowed_on_front
         False,  # used_for_sort_by
         False,  # is_used_in_grid
         False,  # is_filterable_in_grid
         [],  # apply_to
         "0",  # is_searchable
         "0",  # is_visible_in_advanced_search
         "1",  # is_used_for_promo_rules
         "1",  # used_in_product_listing
         142,  # attribute_id
         "size",  # attribute_code
         "select",  # frontend_input
         False,  # is_required
         [
             {
                 "label": " ",
                 "value": ""
             },
             {
                 "label": "55 cm",
                 "value": "91"
             },
             {
                 "label": "XS",
                 "value": "167"
             },
             {
                 "label": "65 cm",
                 "value": "92"
             },
             {
                 "label": "S",
                 "value": "168"
             },
             {
                 "label": "75 cm",
                 "value": "93"
             },
             {
                 "label": "M",
                 "value": "169"
             },
             {
                 "label": "6 foot",
                 "value": "94"
             },
             {
                 "label": "L",
                 "value": "170"
             },
             {
                 "label": "8 foot",
                 "value": "95"
             },
             {
                 "label": "XL",
                 "value": "171"
             },
             {
                 "label": "10 foot",
                 "value": "96"
             },
             {
                 "label": "28",
                 "value": "172"
             },
             {
                 "label": "29",
                 "value": "173"
             },
             {
                 "label": "30",
                 "value": "174"
             },
             {
                 "label": "31",
                 "value": "175"
             },
             {
                 "label": "32",
                 "value": "176"
             },
             {
                 "label": "33",
                 "value": "177"
             },
             {
                 "label": "34",
                 "value": "178"
             },
             {
                 "label": "36",
                 "value": "179"
             },
             {
                 "label": "38",
                 "value": "180"
             }
         ],  # options
         True,  # is_user_defined
         "Talla",  # default_frontend_label
         "int",  # backend_type
         "Magento\\Eav\\Model\\Entity\\Attribute\\Source\\Table",  # backend_model
         "Magento\\Eav\\Model\\Entity\\Attribute\\Source\\Table",  # source_model
         "91",  # default_value
         142,  # id
     ))
     attributes.append(JSONTypes.attributeJSON(
         True,  # is_html_allowed_on_front
         False,  # used_for_sort_by
         True,  # is_used_in_grid
         True,  # is_filterable_in_grid
         [
             "simple",
             "virtual",
             "configurable"
         ],  # apply_to
         "0",  # is_searchable
         "0",  # is_visible_in_advanced_search
         "1",  # is_used_for_promo_rules
         "1",  # used_in_product_listing
         93,  # attribute_id
         "color",  # attribute_code
         "select",  # frontend_input
         False,  # is_required
         [
             {
                 "label": " ",
                 "value": ""
             },
             {
                 "label": "Black",
                 "value": "49"
             },
             {
                 "label": "Blue",
                 "value": "50"
             },
             {
                 "label": "Brown",
                 "value": "51"
             },
             {
                 "label": "Gray",
                 "value": "52"
             },
             {
                 "label": "Green",
                 "value": "53"
             },
             {
                 "label": "Lavender",
                 "value": "54"
             },
             {
                 "label": "Multi",
                 "value": "55"
             },
             {
                 "label": "Orange",
                 "value": "56"
             },
             {
                 "label": "Purple",
                 "value": "57"
             },
             {
                 "label": "Red",
                 "value": "58"
             },
             {
                 "label": "White",
                 "value": "59"
             },
             {
                 "label": "Yellow",
                 "value": "60"
             }
         ],  # options
         True,  # is_user_defined
         "Color",  # default_frontend_label
         "int",  # backend_type
         "Magento\\Eav\\Model\\Entity\\Attribute\\Source\\Table",  # backend_model
         "Magento\\Eav\\Model\\Entity\\Attribute\\Source\\Table",  # source_model
         "49",  # default_value
         93,  # id
     ))
     attributes.append(JSONTypes.attributeJSON(
         False,  # is_html_allowed_on_front
         True,  # used_for_sort_by
         False,  # is_used_in_grid
         False,  # is_filterable_in_grid
         [
             "simple",
             "virtual",
             "bundle",
             "downloadable",
             "configurable"
         ],  # apply_to
         "1",  # is_searchable
         "1",  # is_visible_in_advanced_search
         "0",  # is_used_for_promo_rules
         "1",  # used_in_product_listing
         77,  # attribute_id
         "price",  # attribute_code
         "price",  # frontend_input
         True,  # is_required
         [],  # options
         False,  # is_user_defined
         "Precio",  # default_frontend_label
         "decimal",  # backend_type
         "Magento\\Catalog\\Model\\Product\\Attribute\\Backend\\Price",  # backend_model
         "Magento\\Catalog\\Model\\Product\\Attribute\\Backend\\Price",  # source_model
         "",  # default_value
         77,  # id
     ))
     return valid_response(attributes)
Example #8
0
    def categories(self, **payload):

        #str(json.loads(payload.get('request')).get('_appliedFilters')[0].get('value').get('eq'))
        # == 2 --> root categories

        request_json = json.loads(payload.get('request'))

        # Check if detail of category
        query_json = json.loads(payload.get('request')).get('query')
        if query_json:
            specific_url_key = json.loads(payload.get('request')).get('query').get('bool').get('filter').get('bool').get('must')[0].get('terms').get('url_key')[0]
            int_specific_url_key = int(specific_url_key)
            # Find category
            categories = request.env['product.public.category'].sudo().search_read(
                domain=[('id', '=', int_specific_url_key)],
                fields=['id', 'name', 'display_name', 'parent_id', 'child_id'],
                offset=None, limit=None,
                order=None)
            if categories:
                parent_id = 2
                response = self.categories_to_response(categories, 2, parent_id)
                return simple_response(response)
            else:
                return invalid_response({
                    "error": 500
                })

        applied_filters = json.loads(payload.get('request')).get('_appliedFilters')
        applied_filter = applied_filters[0]

        # Check if detail of category with slug
        if applied_filter.get('attribute') == "slug":
            slug = applied_filter.get('value').get('eq')
            requested_id = int(slug.split("-")[-1]) - self.category_offset
            # Find category
            categories = request.env['product.public.category'].sudo().search_read(
                domain=[('id', '=', requested_id)],
                fields=['id', 'name', 'display_name', 'parent_id', 'child_id'],
                offset=None, limit=None,
                order=None)
            if categories:
                parent_id = 2
                response = self.categories_to_response(categories, 2, parent_id)
                return simple_response(response)
            else:
                return invalid_response({
                    "error": 500
                })

        if applied_filter.get('attribute') == "url_key" or (len(applied_filters) == 1 and applied_filter.get('attribute') == "is_active"):
            parent_id = 2
        else:
            parent_id = applied_filter.get('value').get('eq')

        if parent_id == 2:
            # Root categories
            categories = request.env['product.public.category'].sudo().search_read(
                domain=[('parent_id', '=', False)],
                fields=['id', 'name', 'display_name', 'parent_id', 'child_id'],
                offset=None, limit=None,
                order=None)
            if categories:
                response = self.categories_to_response(categories, 2, parent_id)
                return simple_response(response)
            else:
                return invalid_response({
                    "error": 500
                })
        else:
            categories = request.env['product.public.category'].sudo().search_read(
                domain=[('parent_id', '=', parent_id - self.category_offset)],
                fields=['id', 'name', 'display_name', 'parent_id', 'child_id'],
                offset=None, limit=None,
                order=None)
            if categories:
                response = self.categories_to_response(categories, 3, parent_id)
                return simple_response(response)
            else:
                return invalid_response({
                    "error": 500
                })

            response = {
                "took":1,
                "timed_out": False,
                "_shards":{
                    "total":5,
                    "successful":5,
                    "skipped":0,
                    "failed":0
                },
                "hits":{
                    "total":2,
                    "max_score": None,
                    "hits":[
                        {
                            "_index":"vue_storefront_catalog_1552559102",
                            "_type":"category",
                            "_id":"21",
                            "_score": None,
                            "_source":{
                                "path":"1/2/20/21",
                                "is_active": True,
                                "level":3,
                                "product_count":0,
                                "children_count":"4",
                                "parent_id": parent_id,
                                "name":"Tops" + str(json.loads(payload.get('request')).get('_appliedFilters')[0].get('value').get('eq')),
                                "id":21,
                                "url_path":"women/tops-women/tops-21",
                                "url_key":"tops-21",
                                "children_data":[
                                    {
                                        "id":23
                                    },
                                    {
                                        "id":24
                                    },
                                    {
                                        "id":25
                                    },
                                    {
                                        "id":26
                                    }
                                ]
                            },
                            "sort":[
                                1
                            ]
                        },
                        {
                            "_index":"vue_storefront_catalog_1552559102",
                            "_type":"category",
                            "_id":"22",
                            "_score": None,
                            "_source":{
                                "path":"1/2/20/22",
                                "is_active": True,
                                "level":3,
                                "product_count":0,
                                "children_count":"2",
                                "parent_id": parent_id,
                                "name":"Bottoms",
                                "id":22,
                                "url_key":"bottoms-22",
                                "children_data":[
                                    {
                                        "id":27
                                    },
                                    {
                                        "id":28
                                    }
                                ],
                                "url_path":"women/bottoms-women/bottoms-22"
                            },
                            "sort":[
                                2
                            ]
                        }
                    ]
                }
            }
            return simple_response(response)


        response = {
            "items": [
                {
                    "id": 27,
                    "parent_id": 2,
                    "name": "Category without childs",
                    "is_active": True,
                    "position": 5,
                    "level": 2,
                    "product_count": 2,

                    "entity_type_id": 3,
                    "attribute_set_id": 3,
                    "children_count": 0,
                    "request_path": "accessories/shoes.html",


                    "children_data": [

                    ],
                    "created_at": "2017-11-06 12:16:41",
                    "updated_at": "2017-11-06 12:16:42",
                    "path": "1/2/29",
                    "available_sort_by": [

                    ],
                    "include_in_menu": False,
                    "display_mode": "PAGE",
                    "is_anchor": "0",
                    "url_key": "promotions-29",
                    "url_path": "promotions/promotions-29",
                    "slug": "promotions-29",
                    "tsk": 1551705224325
                }
            ],
            "total": 3,
            "start": 1,
            "perPage": 3,
            "aggregations": [

            ]
        }
        return simple_response(response)

        data = request.env['product.public.category'].sudo().search_read(
            domain=[('parent_id', '=', False)],
            fields=['id', 'name', 'display_name', 'parent_id', 'child_id'],
            offset=None, limit=None,
            order=None)
        if data:
            return valid_response(data)
        else:
            return invalid_response(data)
Example #9
0
    def attributes_json(self, **payload):
        result = {
           "took":0,
           "timed_out": False,
           "_shards":{
              "total":5,
              "successful":5,
              "skipped":0,
              "failed":0
           },
           "hits":{
              "total":4,
              "max_score":0,
              "hits":[
                 {
                    "_index":"vue_storefront_catalog_1552559102",
                    "_type":"attribute",
                    "_id":"145",
                    "_score":0,
                    "_source":{
                       "is_wysiwyg_enabled": False,
                       "is_html_allowed_on_front": True,
                       "used_for_sort_by": False,
                       "is_filterable": True,
                       "is_filterable_in_search": False,
                       "is_used_in_grid": False,
                       "is_visible_in_grid": False,
                       "is_filterable_in_grid": False,
                       "position":0,
                       "apply_to":[

                       ],
                       "is_searchable":"0",
                       "is_visible_in_advanced_search":"0",
                       "is_comparable":"0",
                       "is_used_for_promo_rules":"1",
                       "is_visible_on_front":"0",
                       "used_in_product_listing":"0",
                       "is_visible": True,
                       "scope":"global",
                       "attribute_id":145,
                       "attribute_code":"erin_recommends",
                       "frontend_input":"boolean",
                       "entity_type_id":"4",
                       "is_required": False,
                       "options":[
                          {
                             "label":"Yes",
                             "value":"1"
                          },
                          {
                             "label":"No",
                             "value":"0"
                          }
                       ],
                       "is_user_defined": True,
                       "default_frontend_label":"Erin Recommends",
                       "frontend_labels": None,
                       "backend_type":"int",
                       "source_model":"Magento\\Eav\\Model\\Entity\\Attribute\\Source\\Boolean",
                       "default_value":"",
                       "is_unique":"0",
                       "validation_rules":[

                       ],
                       "id":145,
                       "tsk":1551705231251
                    }
                 },
                 {
                    "_index":"vue_storefront_catalog_1552559102",
                    "_type":"attribute",
                    "_id":"142",
                    "_score":0,
                    "_source":{
                       "is_wysiwyg_enabled": False,
                       "is_html_allowed_on_front": True,
                       "used_for_sort_by": False,
                       "is_filterable": True,
                       "is_filterable_in_search": False,
                       "is_used_in_grid": False,
                       "is_visible_in_grid": False,
                       "is_filterable_in_grid": False,
                       "position":0,
                       "apply_to":[

                       ],
                       "is_searchable":"0",
                       "is_visible_in_advanced_search":"0",
                       "is_comparable":"0",
                       "is_used_for_promo_rules":"1",
                       "is_visible_on_front":"0",
                       "used_in_product_listing":"1",
                       "is_visible": True,
                       "scope":"global",
                       "attribute_id":142,
                       "attribute_code":"size",
                       "frontend_input":"select",
                       "entity_type_id":"4",
                       "is_required": False,
                       "options":[
                          {
                             "label":" ",
                             "value":""
                          },
                          {
                             "label":"55 cm",
                             "value":"91"
                          },
                          {
                             "label":"XS",
                             "value":"167"
                          },
                          {
                             "label":"65 cm",
                             "value":"92"
                          },
                          {
                             "label":"S",
                             "value":"168"
                          },
                          {
                             "label":"75 cm",
                             "value":"93"
                          },
                          {
                             "label":"M",
                             "value":"169"
                          },
                          {
                             "label":"6 foot",
                             "value":"94"
                          },
                          {
                             "label":"L",
                             "value":"170"
                          },
                          {
                             "label":"8 foot",
                             "value":"95"
                          },
                          {
                             "label":"XL",
                             "value":"171"
                          },
                          {
                             "label":"10 foot",
                             "value":"96"
                          },
                          {
                             "label":"28",
                             "value":"172"
                          },
                          {
                             "label":"29",
                             "value":"173"
                          },
                          {
                             "label":"30",
                             "value":"174"
                          },
                          {
                             "label":"31",
                             "value":"175"
                          },
                          {
                             "label":"32",
                             "value":"176"
                          },
                          {
                             "label":"33",
                             "value":"177"
                          },
                          {
                             "label":"34",
                             "value":"178"
                          },
                          {
                             "label":"36",
                             "value":"179"
                          },
                          {
                             "label":"38",
                             "value":"180"
                          }
                       ],
                       "is_user_defined": True,
                       "default_frontend_label":"Size",
                       "frontend_labels": None,
                       "backend_type":"int",
                       "source_model":"Magento\\Eav\\Model\\Entity\\Attribute\\Source\\Table",
                       "default_value":"91",
                       "is_unique":"0",
                       "validation_rules":[

                       ],
                       "id":142,
                       "tsk":1551705231251
                    }
                 },
                 {
                    "_index":"vue_storefront_catalog_1552559102",
                    "_type":"attribute",
                    "_id":"93",
                    "_score":0,
                    "_source":{
                       "is_wysiwyg_enabled": False,
                       "is_html_allowed_on_front": True,
                       "used_for_sort_by": False,
                       "is_filterable": True,
                       "is_filterable_in_search": False,
                       "is_used_in_grid": True,
                       "is_visible_in_grid": False,
                       "is_filterable_in_grid": True,
                       "position":0,
                       "apply_to":[
                          "simple",
                          "virtual",
                          "configurable"
                       ],
                       "is_searchable":"0",
                       "is_visible_in_advanced_search":"0",
                       "is_comparable":"0",
                       "is_used_for_promo_rules":"1",
                       "is_visible_on_front":"0",
                       "used_in_product_listing":"1",
                       "is_visible": True,
                       "scope":"global",
                       "attribute_id":93,
                       "attribute_code":"color",
                       "frontend_input":"select",
                       "entity_type_id":"4",
                       "is_required": False,
                       "options":[
                          {
                             "label":" ",
                             "value":""
                          },
                          {
                             "label":"Black",
                             "value":"49"
                          },
                          {
                             "label":"Blue",
                             "value":"50"
                          },
                          {
                             "label":"Brown",
                             "value":"51"
                          },
                          {
                             "label":"Gray",
                             "value":"52"
                          },
                          {
                             "label":"Green",
                             "value":"53"
                          },
                          {
                             "label":"Lavender",
                             "value":"54"
                          },
                          {
                             "label":"Multi",
                             "value":"55"
                          },
                          {
                             "label":"Orange",
                             "value":"56"
                          },
                          {
                             "label":"Purple",
                             "value":"57"
                          },
                          {
                             "label":"Red",
                             "value":"58"
                          },
                          {
                             "label":"White",
                             "value":"59"
                          },
                          {
                             "label":"Yellow",
                             "value":"60"
                          }
                       ],
                       "is_user_defined": True,
                       "default_frontend_label":"Color",
                       "frontend_labels": None,
                       "backend_type":"int",
                       "source_model":"Magento\\Eav\\Model\\Entity\\Attribute\\Source\\Table",
                       "default_value":"49",
                       "is_unique":"0",
                       "validation_rules":[

                       ],
                       "id":93,
                       "tsk":1551705231251
                    }
                 },
                 {
                    "_index":"vue_storefront_catalog_1552559102",
                    "_type":"attribute",
                    "_id":"77",
                    "_score":0,
                    "_source":{
                       "is_wysiwyg_enabled": False,
                       "is_html_allowed_on_front": False,
                       "used_for_sort_by": True,
                       "is_filterable": True,
                       "is_filterable_in_search": False,
                       "is_used_in_grid": False,
                       "is_visible_in_grid": False,
                       "is_filterable_in_grid": False,
                       "position":0,
                       "apply_to":[
                          "simple",
                          "virtual",
                          "bundle",
                          "downloadable",
                          "configurable"
                       ],
                       "is_searchable":"1",
                       "is_visible_in_advanced_search":"1",
                       "is_comparable":"0",
                       "is_used_for_promo_rules":"0",
                       "is_visible_on_front":"0",
                       "used_in_product_listing":"1",
                       "is_visible": True,
                       "scope":"global",
                       "attribute_id":77,
                       "attribute_code":"price",
                       "frontend_input":"price",
                       "entity_type_id":"4",
                       "is_required": True,
                       "options":[

                       ],
                       "is_user_defined": False,
                       "default_frontend_label":"Price",
                       "frontend_labels": None,
                       "backend_type":"decimal",
                       "backend_model":"Magento\\Catalog\\Model\\Product\\Attribute\\Backend\\Price",
                       "is_unique":"0",
                       "validation_rules":[

                       ],
                       "id":77,
                       "tsk":1551705231251
                    }
                 }
              ]
           }
        }
        return simple_response(result)





        attributes = []
        attributes.append(self.attributeJSON("93", "color", "Color"))
        attributes.append(self.attributeJSON("142", "size", "Size"))
        return valid_response(attributes)