Endpoints & Resources
Create and configure REST API endpoints with full CRUD operations
What is an Endpoint?
An endpoint is a specific URL path that responds to HTTP requests. In REST APIs, endpoints represent resources (like users, products, or posts) and support operations through HTTP methods.
Anatomy of an Endpoint
GET http://localhost:3000/api/users/123• Method: GET (retrieve data)
• Base URL: http://localhost:3000
• Path: /api/users
• Resource ID: 123
HTTP Methods (CRUD Operations)
Each endpoint can support multiple HTTP methods for different operations:
Fetch data from the server (list all or get by ID)
GET /api/usersReturns all users
GET /api/users/123Returns user with ID 123
Create new resources on the server
POST /api/usersCreates a new user
Replace entire resource with new data
PUT /api/users/123Updates user 123 (all fields)
Update only specific fields of a resource
PATCH /api/users/123Updates only specified fields
Remove resources from the server
DELETE /api/users/123Deletes user with ID 123
Creating Endpoints
You have multiple ways to create endpoints in Mock API Builder:
Add endpoints to an existing project through the Settings dialog
Steps:
- Open your project page
- Click the "Settings" button in the top-right
- Go to the "General" tab
- Click "Add Endpoint" button
- Enter endpoint name (e.g., "posts", "comments")
- Add description (optional)
- Choose contract format (Manual Fields or JSON)
- Define your data structure
- Set mock data count (1-100 records)
- Click "Create Endpoint"
💡 Tip: This is perfect for adding missing endpoints to template projects (e.g., adding "Get Blog by ID" to the Blog API template).
Start fresh with a new project and add endpoints during setup
Steps:
- Go to "Create New Project" page
- Enter project name and description
- Set base URL (e.g., "/api")
- Define your first endpoint resource
- Configure response structure
- Generate mock data
Use pre-built templates for common use cases
Available Templates:
- • User Management (users, profiles, auth)
- • E-commerce (products, orders, cart)
- • Blog/CMS (posts, authors, comments)
- • Task Management (tasks, projects)
Import from existing OpenAPI/Swagger specifications
Benefits:
- • Instant endpoint creation from spec
- • Automatically generates schemas
- • Preserves data types and validation
- • Imports descriptions and examples
Endpoint Configuration
Resource Name
The base path for your endpoint (plural nouns recommended):
✓ Good examples:
- •
/users - •
/products - •
/blog-posts
✗ Avoid:
- •
/user(use plural) - •
/getUsers(don't include verb) - •
/Users(use lowercase)
Response Structure
Define what data your endpoint returns:
Status Codes
Automatically handled based on the operation:
URL Parameters & Query Strings
Used to identify specific resources:
/api/users/:idExample: /api/users/123 retrieves user with ID 123
Used for filtering, sorting, and pagination:
Filtering:
/api/users?role=admin&status=activeSorting:
/api/products?sort=price&order=descPagination:
/api/posts?page=2&limit=20Best Practices
✓ /api/users
✗ /api/getUsers
✓ /api/products
✗ /api/product
Use the same naming patterns across all endpoints
Maximum 2-3 levels deep for readability