curl -X POST 'https://api.weir.ai/auth/register' \
-H 'Authorization: Bearer YOUR_ADMIN_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"fullname": "New Admin",
"email": "[email protected]",
"password": "SecureAdminPass123!",
"role": "Admin"
}'
{
"data": {
"adminId": "admin_987654321",
"fullname": "New Admin",
"email": "[email protected]",
"role": "Admin",
"createdAt": "2024-01-22T15:30:00Z"
},
"message": "Admin user created successfully",
"status": "success"
}
Register a new admin user
curl -X POST 'https://api.weir.ai/auth/register' \
-H 'Authorization: Bearer YOUR_ADMIN_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"fullname": "New Admin",
"email": "[email protected]",
"password": "SecureAdminPass123!",
"role": "Admin"
}'
{
"data": {
"adminId": "admin_987654321",
"fullname": "New Admin",
"email": "[email protected]",
"role": "Admin",
"createdAt": "2024-01-22T15:30:00Z"
},
"message": "Admin user created successfully",
"status": "success"
}
curl -X POST 'https://api.weir.ai/auth/register' \
-H 'Authorization: Bearer YOUR_ADMIN_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"fullname": "New Admin",
"email": "[email protected]",
"password": "SecureAdminPass123!",
"role": "Admin"
}'
{
"data": {
"adminId": "admin_987654321",
"fullname": "New Admin",
"email": "[email protected]",
"role": "Admin",
"createdAt": "2024-01-22T15:30:00Z"
},
"message": "Admin user created successfully",
"status": "success"
}
const createAdmin = async (adminData, accessToken) => {
const response = await fetch('https://api.weir.ai/auth/register', {
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(adminData)
});
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
return await response.json();
};
Was this page helpful?