Search Restaurant - MarcoLagalla/marette_backend GitHub Wiki

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

GET


Performing a search on the restaurant could be done in three ways:

  • specify the city that the restaurant should match,
  • specify a query that partially or fully match restaurant name or description,
  • specify both city and query that the restaurant should match.
Field Type Required Unique Comments
query string no no (Optional)
city string no no (Optional)
page_number numeric number of page (Optional)
page_size numeric number of restaurant to return (Optional)

Example of get request

{ 
	"query": "pizz",
	"city": "milano"
}

Returns a sub list of the restaurant that match query specified, 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": 10,
    "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",
            "p_iva": "00859590531",
            "restaurant_category": [
                {
                    "id": 1,
                    "category_name": "Pizzeria"
                },
                {
                    "id": 2,
                    "category_name": "Mensa"
                }
            ],
            "discounts": []
        }
    ]
}

Return codes

Status Description
HTTP_200_OK return restaurant list
HTTP_404_NOT_FOUND restaurant not found
HTTP_400_BAD_REQUEST if no query or city are specified as filter