REST API
User Registration
AuthValidateErrorMedium
What you will learn
- Email verification is mandatory for most production APIs โ assert the flow: register โ verification email โ confirm link โ active account
- Duplicate email on register = 409 Conflict with an email-exists error code โ never 200 with a silent no-op
- Password policy is server-enforced (length, complexity, breach check) โ test rejection with weak passwords, never trust client-side checks
Description
Register a new user account with validation.
Test Scenario
const response = await request.post('/api/v1/auth/register', {
data: {
email: 'new@test.com',
password: 'StrongPass123!',
name: 'New User'
}
});
expect(response.status()).toBe(201);Endpoint
/api/v1/auth/registerTesting Tips
- โขValidate email format
- โขCheck password requirements
- โขHandle duplicate email
// Playwright API Testing - RESTimport { test, expect } from '@playwright/test';test('REST API request', async ({ request }) => {const response = await request.get('/api/v1/resource');expect(response.ok()).toBeTruthy();expect(response.status()).toBe(200);const data = await response.json();expect(data).toBeDefined();});
Challenge ID: rest-auth-register
2 frameworks available
API Playground
Send requests and inspect responses
Endpoint: /api/v1/auth/register
Press Enter to send