API Documentation

User Management

GET /api/users

Fetches all users or a single user by ID.

Query Parameters:

  • id (optional): The ID of the user to fetch. If not provided, all users are returned.

Example Usage:

JavaScript (fetch):
// Fetch all users
fetch('/api/users')

// Fetch a single user
fetch('/api/users?id=123')
cURL:
# Fetch all users
curl -X GET "https://your-domain.com/api/users"

# Fetch a single user
curl -X GET "https://your-domain.com/api/users?id=123"

POST /api/users

Creates a new user.

Request Body (JSON):

  • name (string, required)
  • email (string, required)
  • imei (string, required)

Example Usage:

JavaScript (fetch):
fetch('/api/users', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    name: 'John Doe',
    email: 'john.doe@example.com',
    imei: '123456789012345'
  })
})
cURL:
curl -X POST "https://your-domain.com/api/users"   -H "Content-Type: application/json"   -d '{
    "name": "John Doe",
    "email": "john.doe@example.com",
    "imei": "123456789012345"
  }'

DELETE /api/users

Deletes a user by ID.

Query Parameters:

  • id (string, required): The ID of the user to delete.

Example Usage:

JavaScript (fetch):
fetch('/api/users?id=123', { method: 'DELETE' })
cURL:
curl -X DELETE "https://your-domain.com/api/users?id=123"

POST /api/users/import

Imports users from a CSV file.

Request Body (Form Data):

  • file (File, required): The CSV file containing user data.

Example Usage:

JavaScript (fetch):
const formData = new FormData();
formData.append('file', fileInput.files[0]);

fetch('/api/users/import', {
  method: 'POST',
  body: formData
})
cURL:
curl -X POST "https://your-domain.com/api/users/import"   -F "file=@users.csv"

Wallet Distribution

POST /api/wallet

Distributes a wallet to a user.

Query Parameters:

  • userId (string, required): The ID of the user to receive the wallet.

Example Usage:

JavaScript (fetch):
fetch('/api/wallet?userId=123', { method: 'POST' })
cURL:
curl -X POST "https://your-domain.com/api/wallet?userId=123"

GET /api/wallet/google/[userId]

Generates a Google Wallet pass for a user.

Path Parameters:

  • userId (string, required): The ID of the user.

Example Usage:

fetch('/api/wallet/google/123')

GET /api/wallet/apple/[userId]

Generates an Apple Wallet pass for a user.

Path Parameters:

  • userId (string, required): The ID of the user.

Example Usage:

fetch('/api/wallet/apple/123')

Communication

POST /api/email

Sends an email notification to a user.

Query Parameters:

  • userId (string, required): The ID of the user to email.

Example Usage:

fetch('/api/email?userId=123', { method: 'POST' })

POST /api/push

Sends a push notification to a user.

Query Parameters:

  • userId (string, required): The ID of the user to send a push notification to.

Example Usage:

fetch('/api/push?userId=123', { method: 'POST' })