Fetches all users or a single user by ID.
id
(optional): The ID of the user to fetch. If not provided, all users are returned.// Fetch all users
fetch('/api/users')
// Fetch a single user
fetch('/api/users?id=123')
# 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"
Creates a new user.
name
(string, required)email
(string, required)imei
(string, required)fetch('/api/users', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
name: 'John Doe',
email: 'john.doe@example.com',
imei: '123456789012345'
})
})
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"
}'
Deletes a user by ID.
id
(string, required): The ID of the user to delete.fetch('/api/users?id=123', { method: 'DELETE' })
curl -X DELETE "https://your-domain.com/api/users?id=123"
Imports users from a CSV file.
file
(File, required): The CSV file containing user data.const formData = new FormData();
formData.append('file', fileInput.files[0]);
fetch('/api/users/import', {
method: 'POST',
body: formData
})
curl -X POST "https://your-domain.com/api/users/import" -F "file=@users.csv"
Distributes a wallet to a user.
userId
(string, required): The ID of the user to receive the wallet.fetch('/api/wallet?userId=123', { method: 'POST' })
curl -X POST "https://your-domain.com/api/wallet?userId=123"
Generates a Google Wallet pass for a user.
userId
(string, required): The ID of the user.fetch('/api/wallet/google/123')
Generates an Apple Wallet pass for a user.
userId
(string, required): The ID of the user.fetch('/api/wallet/apple/123')
Sends an email notification to a user.
userId
(string, required): The ID of the user to email.fetch('/api/email?userId=123', { method: 'POST' })
Sends a push notification to a user.
userId
(string, required): The ID of the user to send a push notification to.fetch('/api/push?userId=123', { method: 'POST' })