600 lines
19 KiB
JSON
600 lines
19 KiB
JSON
{
|
|
"info": {
|
|
"name": "AuthHex API Collection",
|
|
"description": "Complete API collection for AuthHex authentication system",
|
|
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
|
|
"_postman_id": "auth-hex-api-collection",
|
|
"version": "1.0.0"
|
|
},
|
|
"variable": [
|
|
{
|
|
"key": "baseUrl",
|
|
"value": "https://localhost:7001/api",
|
|
"description": "Base URL for AuthHex API"
|
|
},
|
|
{
|
|
"key": "accessToken",
|
|
"value": "",
|
|
"description": "JWT Access Token - will be set automatically after login"
|
|
},
|
|
{
|
|
"key": "refreshToken",
|
|
"value": "",
|
|
"description": "JWT Refresh Token - will be set automatically after login"
|
|
}
|
|
],
|
|
"item": [
|
|
{
|
|
"name": "Health & Status",
|
|
"item": [
|
|
{
|
|
"name": "API Status Check",
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{baseUrl}}/status",
|
|
"host": ["{{baseUrl}}"],
|
|
"path": ["status"]
|
|
},
|
|
"description": "Check if API is running and get current timestamp"
|
|
},
|
|
"response": []
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Authentication",
|
|
"item": [
|
|
{
|
|
"name": "Register User",
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"functionName\": \"registerUser\",\n \"payload\": {\n \"fullName\": \"John Doe\",\n \"userName\": \"johndoe\",\n \"email\": \"john.doe@example.com\",\n \"mobileNumber\": \"+1234567890\",\n \"nic\": \"123456789V\",\n \"password\": \"Password123!\",\n \"roleId\": \"00000000-0000-0000-0000-000000000001\",\n \"userTypeId\": \"00000000-0000-0000-0000-000000000001\",\n \"chkUser\": true\n },\n \"reference\": \"REG001\"\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{baseUrl}}/registerUser",
|
|
"host": ["{{baseUrl}}"],
|
|
"path": ["registerUser"]
|
|
},
|
|
"description": "Register a new user account"
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Login User",
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"functionName\": \"loginUser\",\n \"payload\": {\n \"identifier\": \"john.doe@example.com\",\n \"password\": \"Password123!\",\n \"userTypeId\": \"00000000-0000-0000-0000-000000000001\",\n \"deviceName\": \"Postman Client\"\n },\n \"reference\": \"LOG001\"\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{baseUrl}}/loginUser",
|
|
"host": ["{{baseUrl}}"],
|
|
"path": ["loginUser"]
|
|
},
|
|
"description": "Authenticate user and get access token"
|
|
},
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"if (pm.response.code === 200) {",
|
|
" const response = pm.response.json();",
|
|
" if (response.data && response.data.AccessToken) {",
|
|
" pm.collectionVariables.set('accessToken', response.data.AccessToken);",
|
|
" pm.collectionVariables.set('refreshToken', response.data.RefreshToken);",
|
|
" console.log('Access token saved to collection variables');",
|
|
" }",
|
|
"}"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"response": []
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "User Management",
|
|
"item": [
|
|
{
|
|
"name": "Get User Details",
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Bearer {{accessToken}}"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"functionName\": \"getUserDetails\",\n \"payload\": {},\n \"reference\": \"GETUSR001\"\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{baseUrl}}/user",
|
|
"host": ["{{baseUrl}}"],
|
|
"path": ["user"]
|
|
},
|
|
"description": "Get current user profile details"
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get User Sessions",
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Bearer {{accessToken}}"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"functionName\": \"getUserSessions\",\n \"payload\": {},\n \"reference\": \"GETSESS001\"\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{baseUrl}}/user",
|
|
"host": ["{{baseUrl}}"],
|
|
"path": ["user"]
|
|
},
|
|
"description": "Get all active sessions for current user"
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Change User Status",
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Bearer {{accessToken}}"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"functionName\": \"ChangeUserStatus\",\n \"payload\": {\n \"userId\": \"00000000-0000-0000-0000-000000000001\",\n \"isActive\": true\n },\n \"reference\": \"CHGSTAT001\"\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{baseUrl}}/user",
|
|
"host": ["{{baseUrl}}"],
|
|
"path": ["user"]
|
|
},
|
|
"description": "Activate or deactivate a user account"
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Lock User Account",
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Bearer {{accessToken}}"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"functionName\": \"LockUserAccount\",\n \"payload\": {\n \"userId\": \"00000000-0000-0000-0000-000000000001\",\n \"isLocked\": true\n },\n \"reference\": \"LOCKUSR001\"\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{baseUrl}}/user",
|
|
"host": ["{{baseUrl}}"],
|
|
"path": ["user"]
|
|
},
|
|
"description": "Lock or unlock a user account"
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Change User Password",
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Bearer {{accessToken}}"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"functionName\": \"ChangeUserPassword\",\n \"payload\": {\n \"currentPassword\": \"OldPassword123!\",\n \"newPassword\": \"NewPassword123!\"\n },\n \"reference\": \"CHGPASS001\"\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{baseUrl}}/user",
|
|
"host": ["{{baseUrl}}"],
|
|
"path": ["user"]
|
|
},
|
|
"description": "Change current user password"
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Logout User",
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Bearer {{accessToken}}"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"functionName\": \"LogoutUser\",\n \"payload\": {},\n \"reference\": \"LOGOUT001\"\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{baseUrl}}/user",
|
|
"host": ["{{baseUrl}}"],
|
|
"path": ["user"]
|
|
},
|
|
"description": "Logout current user and invalidate session"
|
|
},
|
|
"response": []
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Two-Factor Authentication (2FA)",
|
|
"item": [
|
|
{
|
|
"name": "Get 2FA Status",
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Bearer {{accessToken}}"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"functionName\": \"getTwoFAStatus\",\n \"payload\": {},\n \"reference\": \"2FASTAT001\"\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{baseUrl}}/user",
|
|
"host": ["{{baseUrl}}"],
|
|
"path": ["user"]
|
|
},
|
|
"description": "Check if 2FA is enabled for current user"
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Initiate 2FA Setup",
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Bearer {{accessToken}}"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"functionName\": \"initiateTwoFASetup\",\n \"payload\": {},\n \"reference\": \"2FAINIT001\"\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{baseUrl}}/user",
|
|
"host": ["{{baseUrl}}"],
|
|
"path": ["user"]
|
|
},
|
|
"description": "Generate QR code and secret for 2FA setup"
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Complete 2FA Setup",
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Bearer {{accessToken}}"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"functionName\": \"completeTwoFASetup\",\n \"payload\": {\n \"verificationCode\": \"123456\"\n },\n \"reference\": \"2FACOMP001\"\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{baseUrl}}/user",
|
|
"host": ["{{baseUrl}}"],
|
|
"path": ["user"]
|
|
},
|
|
"description": "Complete 2FA setup by verifying the code"
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Verify 2FA Code",
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Bearer {{accessToken}}"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"functionName\": \"verifyTwoFA\",\n \"payload\": {\n \"verificationCode\": \"123456\"\n },\n \"reference\": \"2FAVRF001\"\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{baseUrl}}/user",
|
|
"host": ["{{baseUrl}}"],
|
|
"path": ["user"]
|
|
},
|
|
"description": "Verify 2FA code during login or operations"
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Disable 2FA",
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Bearer {{accessToken}}"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"functionName\": \"disableTwoFA\",\n \"payload\": {\n \"verificationCode\": \"123456\"\n },\n \"reference\": \"2FADIS001\"\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{baseUrl}}/user",
|
|
"host": ["{{baseUrl}}"],
|
|
"path": ["user"]
|
|
},
|
|
"description": "Disable 2FA for current user"
|
|
},
|
|
"response": []
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Password Recovery",
|
|
"item": [
|
|
{
|
|
"name": "Forgot Password (OTP)",
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"functionName\": \"forgotPassword\",\n \"payload\": {\n \"identifier\": \"john.doe@example.com\",\n \"useResetLink\": false,\n \"numberOfDigits\": 6\n },\n \"reference\": \"FORGPWD001\"\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{baseUrl}}/forgotPassword",
|
|
"host": ["{{baseUrl}}"],
|
|
"path": ["forgotPassword"]
|
|
},
|
|
"description": "Send OTP for password recovery via SMS/Email"
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Forgot Password (Reset Link)",
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"functionName\": \"forgotPassword\",\n \"payload\": {\n \"identifier\": \"john.doe@example.com\",\n \"useResetLink\": true\n },\n \"reference\": \"FORGPWD002\"\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{baseUrl}}/forgotPassword",
|
|
"host": ["{{baseUrl}}"],
|
|
"path": ["forgotPassword"]
|
|
},
|
|
"description": "Send password reset link via Email"
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Verify OTP",
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"functionName\": \"verifyOTP\",\n \"payload\": {\n \"referenceNumber\": \"REF123456789\",\n \"otpCode\": \"123456\"\n },\n \"reference\": \"VEROTP001\"\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{baseUrl}}/recovery",
|
|
"host": ["{{baseUrl}}"],
|
|
"path": ["recovery"]
|
|
},
|
|
"description": "Verify OTP code for password recovery"
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Reset Password with Token",
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"functionName\": \"resetPasswordWithToken\",\n \"payload\": {\n \"resetToken\": \"your-reset-token-here\",\n \"newPassword\": \"NewPassword123!\"\n },\n \"reference\": \"RESETPWD001\"\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{baseUrl}}/recovery",
|
|
"host": ["{{baseUrl}}"],
|
|
"path": ["recovery"]
|
|
},
|
|
"description": "Reset password using reset token from email link"
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Reset Password with OTP",
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"functionName\": \"resetPassword\",\n \"payload\": {\n \"referenceNumber\": \"REF123456789\",\n \"newPassword\": \"NewPassword123!\"\n },\n \"reference\": \"RESETPWD002\"\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{baseUrl}}/recovery",
|
|
"host": ["{{baseUrl}}"],
|
|
"path": ["recovery"]
|
|
},
|
|
"description": "Reset password after OTP verification"
|
|
},
|
|
"response": []
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Utility Functions",
|
|
"item": [
|
|
{
|
|
"name": "Check Availability",
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"functionName\": \"isAvailable\",\n \"payload\": {\n \"resetToken\": \"john.doe@example.com\"\n },\n \"reference\": \"CHKAVAIL001\"\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{baseUrl}}/isAvailable",
|
|
"host": ["{{baseUrl}}"],
|
|
"path": ["isAvailable"]
|
|
},
|
|
"description": "Check if email/username/mobile is available for registration"
|
|
},
|
|
"response": []
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{accessToken}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"event": [
|
|
{
|
|
"listen": "prerequest",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
""
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
""
|
|
]
|
|
}
|
|
}
|
|
]
|
|
} |