Introduction
The Simple REST data provider is designed for REST APIs that follow the json-server conventions. It provides a straightforward way to connect Refine applications to REST APIs with standard CRUD operations.Installation
Install the Simple REST data provider package:Basic Usage
Import and configure the data provider with your API URL:API Expectations
The Simple REST data provider expects your API to follow these conventions:Get List
x-total-count header:
Get One
Get Many
Create
Update
Delete
Configuration
Advanced Usage
Custom Headers per Request
You can pass custom headers using themeta property:
Custom HTTP Method
Override the default HTTP method:Filtering
The Simple REST data provider supports various filter operators:Sorting
Sort your data using thesorters property:
Pagination
Pagination is handled automatically:Complete Example
Here’s a complete example of using the Simple REST data provider:Error Handling
The Simple REST data provider automatically handles HTTP errors. You can catch and handle them in your components:Supported Operators
The Simple REST data provider supports the following filter operators:eq: Equals (e.g.,status=published)ne: Not equals (e.g.,status_ne=draft)lt: Less than (e.g.,views_lt=100)lte: Less than or equal (e.g.,views_lte=100)gt: Greater than (e.g.,views_gt=100)gte: Greater than or equal (e.g.,views_gte=100)contains: Contains (e.g.,title_like=hello)in: In array (e.g.,id=1&id=2&id=3)nin: Not in array
Next Steps
Data Providers Overview
Learn about other data providers
Creating Custom Provider
Build your own data provider