Search Restaurant by query - MarcoLagalla/marette_backend GitHub Wiki

Name Search Restaurant
Description Search registered restaurant by query
URL _api/v1/webapp/restaurant/queryset
Allowed methods GET
Authorizations GET (AllowAny)

Params

Parameter Type Description
<int:page_number> integer number of page (Optional)
<int:page_size> integer number of restaurant to return (Optional)

GET


Performing a search on the restaurant that are present on a specific category.

Field Type Required Unique Comments
query string no no (Optional)
city string no no (Optional)
restaurant_category string no no (Optional)
aperto_ora 1 no no (Optional)
apre_alle 1 no no (Optional) NOT IMPLEMENTED

Example of get request

{ 
	"page_size":1,
	"page_number":1,
	"restaurant_name": "bella napoli",
	"restaurant_city": "Milano",
	"restaurant_category": "Pizzeria",
	"aperto_ora": 1
}

Returns a sub list of the restaurant that match the specified category, other restaurant can be retrieved following the URL provided by paginator. Anyone can retrieve the details.

{
    "first": 1,
    "previous": null,
    "next": null,
    "last": 1,
    "page_size": 1,
    "page_number": 1,
    "results": [
        {
            "id": 4,
            "slug": "la-pizza-da-giove",
            "url": "4/la-pizza-da-giove",
            "activity_name": "la pizza da giove",
            "activity_description": "mamma che buona questa pizza",
            "image": "/media/placeholder/restaurant/placeholder.png",
            "city": "milano",
            "address": "via della roccia",
            "n_civ": 78,
            "cap": 27100,
            "restaurant_number": "+393110276102",
            "restaurant_category": [
                {
                    "id": 1,
                    "category_name": "Pizzeria"
                },
                {
                    "id": 2,
                    "category_name": "Mensa"
                }
            ],
            "p_iva": "00859590531",
            "discounts": []
        }
    ]
}

If no param are specified, return the lists of all available restaurants. If no restaurant are present, returns:

{
    "error": [
        "Nessun Ristorante trovato secondo i filtri specificati."
    ]
}

Return codes

Status Description
HTTP_200_OK return restaurant list
HTTP_404_NOT_FOUND restaurant not found