Skip to main content
GET
/
users
/
:id
curl --location 'https://api.maytravel.com/users/1' \
  --header 'Content-Type: application/json'
[
  {
    "id": 1,
    "username": "johndoe",
    "email": "johndoe@example.com",
    "password": "hashed_password",
    "role": "user"
  }
]

Request

id
integer
required
The unique identifier of the user to retrieve
curl --location 'https://api.maytravel.com/users/1' \
  --header 'Content-Type: application/json'

Response

Returns an array containing the user object (or empty array if not found).
id
integer
Unique identifier for the user
username
string
The user’s username
email
string
The user’s email address
password
string
The user’s hashed password
role
string
The user’s role in the system
[
  {
    "id": 1,
    "username": "johndoe",
    "email": "johndoe@example.com",
    "password": "hashed_password",
    "role": "user"
  }
]

Error Responses

error
string
Error message describing what went wrong

Status Codes

  • 200 - Success: Returns array with user object
  • 404 - Not Found: User with specified ID does not exist
  • 500 - Server Error: Internal server error occurred

Build docs developers (and LLMs) love