Recent Topics

Bagisto API response Formatting



  • Hello , I am new here. Can anyone please explain how Bagisto formats api json response like this:

    {
        "data": [
            {
                "id": 12,
                "code": null,
                "name": "Air Fresheners",
                "slug": "air-fresheners",
                "display_mode": "products_and_description",
                "description": "<p>Air Fresheners</p>\r\n<p>&nbsp;</p>",
                "meta_title": "",
                "meta_description": "",
                "meta_keywords": "",
                "status": 1,
                "image_url": null,
                "category_icon_path": null,
                "additional": null,
                "created_at": "2021-12-15T16:33:19.000000Z",
                "updated_at": "2021-12-19T18:02:38.000000Z"
            },
            {
                "id": 11,
                "code": null,
                "name": "Dairy",
                "slug": "dairy",
                "display_mode": "products_and_description",
                "description": "<p>Dairy</p>\r\n<p>&nbsp;</p>",
                "meta_title": "",
                "meta_description": "",
                "meta_keywords": "",
                "status": 1,
                "image_url": null,
                "category_icon_path": "http://bg-shop.loc/storage/velocity/category_icon_path/11/90xqpMnFfZjriuhEFj1auTDWZq4hzTC5lM11cgGn.png",
                "additional": null,
                "created_at": "2021-12-15T16:32:15.000000Z",
                "updated_at": "2021-12-19T18:15:56.000000Z"
            },
            {
                "id": 10,
                "code": null,
                "name": "Snacks",
                "slug": "snacks",
                "display_mode": "products_and_description",
                "description": "<p>Snacks</p>\r\n<p>&nbsp;</p>",
                "meta_title": "",
                "meta_description": "",
                "meta_keywords": "",
                "status": 1,
                "image_url": null,
                "category_icon_path": null,
                "additional": null,
                "created_at": "2021-12-15T16:31:27.000000Z",
                "updated_at": "2021-12-19T18:00:08.000000Z"
            },
            {
                "id": 9,
                "code": null,
                "name": "Fruits & Vegetables",
                "slug": "fruits-vegetables",
                "display_mode": "products_and_description",
                "description": "<p>Fruits &amp; Vegetables</p>\r\n<p>&nbsp;</p>",
                "meta_title": "",
                "meta_description": "",
                "meta_keywords": "",
                "status": 1,
                "image_url": null,
                "category_icon_path": null,
                "additional": null,
                "created_at": "2021-12-15T16:30:29.000000Z",
                "updated_at": "2021-12-19T18:00:08.000000Z"
            },
            {
                "id": 8,
                "code": null,
                "name": "Diapers & Wipes",
                "slug": "diapers-wipes",
                "display_mode": "products_and_description",
                "description": "<p>Our Baby Diapers and Wipes are made to ensure life is kept easy, simple and comfortable for you and your baby.</p>",
                "meta_title": "",
                "meta_description": "",
                "meta_keywords": "",
                "status": 1,
                "image_url": null,
                "category_icon_path": null,
                "additional": null,
                "created_at": "2021-12-15T16:29:32.000000Z",
                "updated_at": "2021-12-19T17:55:04.000000Z"
            },
            {
                "id": 7,
                "code": null,
                "name": "Newborn Essentials",
                "slug": "newborn-essentials",
                "display_mode": "products_and_description",
                "description": "<p>A car seat is one of the most important essentials on our newborn baby checklist.</p>",
                "meta_title": "",
                "meta_description": "",
                "meta_keywords": "",
                "status": 1,
                "image_url": null,
                "category_icon_path": null,
                "additional": null,
                "created_at": "2021-12-15T16:27:57.000000Z",
                "updated_at": "2021-12-19T17:55:04.000000Z"
            },
            {
                "id": 6,
                "code": null,
                "name": "Home Appliances",
                "slug": "home-appliances",
                "display_mode": "products_and_description",
                "description": "<p>Enjoy free shipping and easy returns on toys from Kohl's. Find toys for children of all ages including stuffed animals, dolls, costumes, games</p>",
                "meta_title": "",
                "meta_description": "",
                "meta_keywords": "",
                "status": 1,
                "image_url": null,
                "category_icon_path": "http://bg-shop.loc/storage/velocity/category_icon_path/6/VwIgoWQupda0hUjq7Zq1okNVjmQKXkEoCnw9w4Mc.png",
                "additional": null,
                "created_at": "2021-12-15T16:25:27.000000Z",
                "updated_at": "2021-12-19T18:06:50.000000Z"
            },
            {
                "id": 5,
                "code": null,
                "name": "Beauty & Health",
                "slug": "beauty-health",
                "display_mode": "products_and_description",
                "description": "<p>Looking for skin, makeup, hair, or nail care tips? Considering cosmetic or anti-aging procedures? Find the latest beauty information here.</p>",
                "meta_title": "",
                "meta_description": "",
                "meta_keywords": "",
                "status": 1,
                "image_url": null,
                "category_icon_path": "http://bg-shop.loc/storage/velocity/category_icon_path/5/C83cKJMDgwK5FQwGFLnga73soPluJJD23FIlcqh5.png",
                "additional": null,
                "created_at": "2021-12-15T16:23:13.000000Z",
                "updated_at": "2021-12-19T18:05:24.000000Z"
            },
            {
                "id": 4,
                "code": null,
                "name": "Home & Cleaning",
                "slug": "home-cleaning",
                "display_mode": "products_and_description",
                "description": "<p><span style=\"color: #4d5156; font-family: arial, sans-serif;\">Looking for&nbsp;</span><span style=\"font-weight: bold; color: #5f6368; font-family: arial, sans-serif;\">home cleaning</span><span style=\"color: #4d5156; font-family: arial, sans-serif;\">&nbsp;services near you? Sheba.xyz has experienced professionals for this service</span></p>",
                "meta_title": "",
                "meta_description": "",
                "meta_keywords": "",
                "status": 1,
                "image_url": null,
                "category_icon_path": "http://bg-shop.loc/storage/velocity/category_icon_path/4/yuNfKR1dyPqbmR5PIWsTVAAPvPfdOv2yLOe1VitG.png",
                "additional": null,
                "created_at": "2021-12-15T16:09:49.000000Z",
                "updated_at": "2021-12-19T18:02:38.000000Z"
            }
        ],
        "links": {
            "first": "http://bg-shop.loc/api/categories?page=1",
            "last": "http://bg-shop.loc/api/categories?page=2",
            "prev": null,
            "next": "http://bg-shop.loc/api/categories?page=2"
        },
        "meta": {
            "current_page": 1,
            "from": 1,
            "last_page": 2,
            "links": [
                {
                    "url": null,
                    "label": "&laquo; Previous",
                    "active": false
                },
                {
                    "url": "http://bg-shop.loc/api/categories?page=1",
                    "label": "1",
                    "active": true
                },
                {
                    "url": "http://bg-shop.loc/api/categories?page=2",
                    "label": "2",
                    "active": false
                },
                {
                    "url": "http://bg-shop.loc/api/categories?page=2",
                    "label": "Next &raquo;",
                    "active": false
                }
            ],
            "path": "http://bg-shop.loc/api/categories",
            "per_page": 10,
            "to": 10,
            "total": 13
        }
    }
    

    I mean in which file does bagisto formats the json response like { 'data':{....},'meta':{..} } and how can I modify this response.

    Thanks.



  • @ahnaf22 said in Bagisto API response Formatting:

    does

    HI @ahnaf22
    Can you please eleborate. what exactly you want to do?



  • @sanjay-webkul it would be helpful to know in which file or where bagisto formats api response like this. I just want the informations inside "data" and need to modify the responses inside it.
    Thanks.



  • @ahnaf22
    You can gothrough Here for the same.


Log in to reply