monorepo/cloud/maplepress-backend/docs/API/hello.md

1.5 KiB

Hello (Authenticated)

POST /api/v1/hello

A simple authenticated endpoint that returns a personalized greeting message. This endpoint demonstrates JWT authentication and can be used to verify that your access token is working correctly.

Authentication: Required (JWT token)

Headers:

  • Content-Type: application/json
  • Authorization: JWT {access_token}

Request Body:

Field Type Required Description
name string Yes Name to include in greeting

Example Request:

curl -X POST http://localhost:8000/api/v1/hello \
  -H "Content-Type: application/json" \
  -H "Authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -d '{"name": "Alice"}'

Example Response (200 OK):

{
  "message": "Hello, Alice! Welcome to MaplePress Backend."
}

Error Responses:

This endpoint returns errors in RFC 9457 (Problem Details for HTTP APIs) format.

Content-Type: application/problem+json

400 Bad Request - Missing name field:

{
  "type": "about:blank",
  "title": "Bad Request",
  "status": 400,
  "detail": "Name is required"
}

401 Unauthorized - Missing or invalid JWT token:

{
  "type": "about:blank",
  "title": "Unauthorized",
  "status": 401,
  "detail": "Authentication required"
}

Notes:

  • This endpoint requires a valid JWT access token
  • The name field is required in the request body
  • Useful for testing authentication and verifying token validity
  • Returns a personalized greeting with the provided name