Skip to content

Jatink4/MeraSafar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MeraSafar Backend API Documentation
Welcome to the MeraSafar API documentation. This document provides detailed information about the available endpoints in the MeraSafar backend.

Base URL: {BaseURL}

Endpoints

/users/register
Registers a new user.

  • Method: POST
  • Request Body:
{
  "fullname": {
    "firstname": "string",
    "lastname": "string (optional)"
  },
  "email": "string",
  "password": "string"
}
  • Response:
{
  "user": {
    "fullname": {
      "firstname": "string",
      "lastname": "string"
    },
    "email": "string"
  },
  "token": "string"
}

/users/login
Authenticates a user.

  • Method: POST
  • Request Body:
{
  "email": "string",
  "password": "string"
}
  • Response:
{
  "user": {
    "fullname": {
      "firstname": "string",
      "lastname": "string"
    },
    "email": "string"
  },
  "token": "string"
}

/users/profile
Retrieves the authenticated user's profile.

  • Method: GET
  • Authentication: Bearer Token
  • Response:
{
  "user": {
    "fullname": {
      "firstname": "string",
      "lastname": "string"
    },
    "email": "string"
  }
}

/users/logout
Logs out the current user.

  • Method: GET
  • Authentication: Bearer Token
  • Response:
{
  "message": "Logout successful"
}

/captains/register
Registers a new captain.

  • Method: POST
  • Request Body:
{
  "fullname": {
    "firstname": "string",
    "lastname": "string"
  },
  "email": "string",
  "password": "string",
  "vehicle": {
    "color": "string",
    "plate": "string",
    "capacity": "number",
    "vehicleType": "string"
  }
}
  • Response:
{
  "captain": {
    "fullname": {
      "firstname": "string",
      "lastname": "string"
    },
    "email": "string",
    "vehicle": {
      "color": "string",
      "plate": "string",
      "capacity": "number",
      "vehicleType": "string"
    }
  },
  "token": "string"
}

/captains/login
Authenticates a captain.

  • Method: POST
  • Request Body:
{
  "email": "string",
  "password": "string"
}
  • Response:
{
  "captain": {
    "fullname": {
      "firstname": "string",
      "lastname": "string"
    },
    "email": "string",
    "vehicle": {
      "color": "string",
      "plate": "string",
      "capacity": "number",
      "vehicleType": "string"
    }
  },
  "token": "string"
}

/captains/profile
Retrieves the authenticated captain's profile.

  • Method: GET
  • Authentication: Bearer Token
  • Response:
{
  "captain": {
    "fullname": {
      "firstname": "string",
      "lastname": "string"
    },
    "email": "string",
    "vehicle": {
      "color": "string",
      "plate": "string",
      "capacity": "number",
      "vehicleType": "string"
    }
  }
}

/captains/logout
Logs out the current captain.

  • Method: GET
  • Authentication: Bearer Token
  • Response:
{
  "message": "Logout successful"
}

/maps/get-coordinates
Retrieves coordinates for an address.

  • Method: GET
  • Query Parameters:
    • address: string (required)
  • Response:
{
  "ltd": "number",
  "lng": "number"
}

/maps/get-distance-time
Retrieves the distance and estimated travel time.

  • Method: GET
  • Query Parameters:
    • origin: string (required)
    • destination: string (required)
  • Response:
{
  "distance": {
    "text": "string",
    "value": "number"
  },
  "duration": {
    "text": "string",
    "value": "number"
  }
}

/rides/create
Creates a new ride.

  • Method: POST
  • Authentication: Bearer Token
  • Request Body:
{
  "pickup": "string",
  "destination": "string",
  "vehicleType": "string"
}
  • Response:
{
  "ride": {
    "user": "string",
    "pickup": "string",
    "destination": "string",
    "fare": "number",
    "status": "string",
    "duration": "number",
    "distance": "number",
    "otp": "string"
  }
}

/rides/get-fare
Estimates the fare for a ride.

  • Method: GET
  • Authentication: Bearer Token
  • Query Parameters:
    • pickup: string (required)
    • destination: string (required)
  • Response:
{
  "auto": "number",
  "car": "number",
  "moto": "number"
}

Conclusion: MeraSafar API simplifies user and captain management, ride creation, and map-related functionalities. For any additional questions or issues, please contact our support team.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages