Tzine Web App - API Endpoints Documentation

Overview

This document provides a comprehensive overview of all API endpoints in the Tzine web application. Tzine is a restaurant discovery platform that connects food lovers with local restaurants.

API Base Url: https://tzine.click/api/


API Endpoints


Restaurant Management


GET /api/restaurants

Purpose: Retrieve all restaurants-

Method: GET

Authentication: None required

Response:

{ 
    "success": true, 
    "data": [ 
        {     
            "_id": "string", 
            "name": "string", 
            "location": "string",     
            "owner": "string", 
            "email": "string",     
            "phoneNumber": "string",     
            "instagramHandle": "string",     
            "coverPhoto": "string",     
            "createdAt": "string" 
        } 
    ] 
} 

POST /api/restaurants

Purpose: Create a new restaurant

Method: POST

Authentication: Admin required

Body:

{ 
    "name": "string", 
    "location": "string", 
    "owner": "string", 
    "email": "string", 
    "phoneNumber": "string", 
    "instagramHandle": "string", 
    "coverPhoto": "string" 
} 

GET /api/restaurants/[id]

Purpose: Get specific restaurant with menu data

Method: GET

Parameters: id (restaurant ID)

Authentication: None required

Response: Returns restaurant details and associated menu


PUT /api/restaurants/[id]

Purpose: Update a specific restaurant

Method: PUT

Parameters: id (restaurant ID)

Authentication: Admin required

Body: Restaurant update data


DELETE /api/restaurants/[id]

Purpose: Delete a restaurant and its menu

Method: DELETE

Parameters: id (restaurant ID)

Authentication: Admin required



GET /api/menus

Purpose: Get menus (optionally filtered by restaurant)

Method: GET

Query Parameters: - restaurantId (optional): Filter by specific restaurant

Authentication: None required

Response: Array of menu objects with populated restaurant data


POST /api/menus

Purpose: Create a new menu

Method: POST

Authentication: Admin required

Body:

{
    "restaurantId": "string", 
    "dishes": [ 
        { 
            "name": "string", 
            "description": "string", 
            "price": "number", 
            "coverPhoto": "string" 
        } 
    ] 
} 

GET /api/menus/[id]

Purpose: Get specific menu by ID

Method: GET

Parameters: id (menu ID)

Authentication: None required


PUT /api/menus/[id]

Purpose: Update a specific menu

Method: PUT

Parameters: id (menu ID)

Authentication: Admin required


DELETE /api/menus/[id]

Purpose: Delete a specific menu

Method: DELETE

Parameters: id (menu ID)

Authentication: Admin required


GET /api/menu/[id]

Purpose: Get menu by restaurant ID (alternative endpoint)

Method: GET

Parameters: id (restaurant ID)

Authentication: None required


Search Functionality


GET /api/search

Purpose: Search restaurants and dishes

Method: GET

Query Parameters:

  • q: Search query (required)

  • type: Search type (`all`, restaurants, dishes) - default: all

  • location: Location filter (optional)

  • limit: Results per page - default: 20

  • page: Page number - default: 1

Authentication: None required

Response: Paginated search results with restaurants and dishes


POST /api/search

Purpose: Advanced search with filters

Method: POST

Authentication: None required

Body:

{
    "query": "string", 
    "filters": { 
        "location": "string", 
        "owner": "string", 
        "hasInstagram": "boolean", 
        "dateRange": { 
            "start": "date", 
            "end": "date" 
        }, 
        "priceRange": { 
            "min": "number", 
            "max": "number" 
        } 
    }, 
    "sort": { 
        "field": "string", 
        "order": "asc|desc" 
    }, 
    "limit": "number", 
    "page": "number" 
} 

Response: Paginated search results with restaurants and dishes


This documentation provides a complete overview of the Tzine web application's API endpoints. The Web Application is designed to be a comprehensive restaurant discovery platform with both public-facing features and admin management capabilities.


Testing the API

While you can test the API using any tool that can make HTTP requests (like curl, browser tools, or code clients), we highly recommend using Postman for a more efficient and feature-rich experience during development and testing

Why Postman?

  • Easily build and send various HTTP requests (GET, POST, PUT, DELETE).

  • Organize requests into collections for easy re-use and sharing.

  • Create environment variables to manage different API keys or endpoints (e.g., development, staging, production).

  • Automate tests to validate response structures or data.

  • Visualise request and response data clearly.

  • Download and install Postman from Postman Download Link.

Support and Contact Information

Technical support details

  • Email: support@tzine.click

  • Phone: +255 (763) 24 6216

Updated on