Overview
This page documents all available REST API endpoints in the application. Endpoints are organized by extension.All private endpoints require authentication. Public endpoints can be accessed without credentials.
Sample Extension
The sample extension provides example endpoints demonstrating EverShop’s REST API patterns.Create Foo
Creates a new Foo resource.Endpoint Details
string
default:"POST"
HTTP Method
string
default:"/foos"
Endpoint URL path
string
default:"private"
Requires authentication
Request Body
string
required
The name of the foo item
string
required
A description of the foo item
Response
boolean
Indicates if the operation was successful
object
Contains the created resource
Implementation Details
- route.json
- Middleware
- Handler
extensions/sample/src/api/createFoo/route.json
Endpoint Reference
All available endpoints organized by extension:Sample Extension
POST
/foos - Create a new Foo resourceStatus: Private (requires authentication)Creating Custom Endpoints
To add your own REST endpoints, follow these steps:1
Create Extension
Create a new extension if you don’t have one:
2
Define Route Configuration
Create a
route.json file:extensions/myExtension/src/api/myEndpoint/route.json
3
Implement Handler
Create your endpoint handler:
extensions/myExtension/src/api/myEndpoint/myEndpoint.ts
4
Register Extension
Ensure your extension is registered in
config/default.json:5
Test Your Endpoint
Start the development server and test:
Authentication
Endpoints marked as"access": "private" require authentication. The authentication mechanism depends on your EverShop configuration.
HTTP Methods
Supported HTTP methods for REST endpoints:- GET
- POST
- PUT
- PATCH
- DELETE
- Multiple Methods
Use for retrieving resources:
Error Handling
Best practices for error handling in REST endpoints:Next Steps
REST API Overview
Learn about REST API conventions and best practices
GraphQL API
Explore the GraphQL API as an alternative
API Endpoints Guide
Step-by-step guide to creating endpoints
Extensions
Learn about available extensions