Skip to content

Commit 700d9dc

Browse files
authored
Merge pull request #11118 from femrek/docs/ra-data-json-server-delete-many-in-docs
docs: Add deleteMany method to README and source code docs for json-server Data Provider.
2 parents e00a65d + b38f8a9 commit 700d9dc

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

packages/ra-data-json-server/README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,17 @@ npm install --save ra-data-json-server
1414

1515
This Data Provider fits REST APIs powered by [JSON Server](https://github.com/typicode/json-server), such as [JSONPlaceholder](https://jsonplaceholder.typicode.com/).
1616

17-
| Method | API calls |
18-
| ------------------ | ------------------------------------------------------------------------------------------------------- |
19-
| `getList` | `GET http://my.api.url/posts?_sort=title&_order=ASC&_start=0&_end=24&title=bar` |
20-
| `getOne` | `GET http://my.api.url/posts/123` |
21-
| `getMany` | `GET http://my.api.url/posts?id=123&id=456&id=789` |
22-
| `getManyReference` | `GET http://my.api.url/posts?author_id=345` |
23-
| `create` | `POST http://my.api.url/posts` |
24-
| `update` | `PUT http://my.api.url/posts/123` |
25-
| `updateMany` | `PUT http://my.api.url/posts/123`, `PUT http://my.api.url/posts/456`, `PUT http://my.api.url/posts/789` |
26-
| `delete` | `DELETE http://my.api.url/posts/123` |
17+
| Method | API calls |
18+
| ------------------ | ---------------------------------------------------------------------------------------------------------------- |
19+
| `getList` | `GET http://my.api.url/posts?_sort=title&_order=ASC&_start=0&_end=24&title=bar` |
20+
| `getOne` | `GET http://my.api.url/posts/123` |
21+
| `getMany` | `GET http://my.api.url/posts?id=123&id=456&id=789` |
22+
| `getManyReference` | `GET http://my.api.url/posts?author_id=345` |
23+
| `create` | `POST http://my.api.url/posts` |
24+
| `update` | `PUT http://my.api.url/posts/123` |
25+
| `updateMany` | `PUT http://my.api.url/posts/123`, `PUT http://my.api.url/posts/456`, `PUT http://my.api.url/posts/789` |
26+
| `delete` | `DELETE http://my.api.url/posts/123` |
27+
| `deleteMany` | `DELETE http://my.api.url/posts/123`, `DELETE http://my.api.url/posts/456`, `DELETE http://my.api.url/posts/789` |
2728

2829
**Note**: The JSON Server REST Data Provider expects the API to include a `X-Total-Count` header in the response to `getList` and `getManyReference` calls. The value must be the total number of resources in the collection. This allows react-admin to know how many pages of resources there are in total, and build the pagination controls.
2930

packages/ra-data-json-server/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { fetchUtils, DataProvider } from 'ra-core';
1616
* update => PUT http://my.api.url/posts/123
1717
* updateMany => PUT http://my.api.url/posts/123, PUT http://my.api.url/posts/456, PUT http://my.api.url/posts/789
1818
* delete => DELETE http://my.api.url/posts/123
19+
* deleteMany => DELETE http://my.api.url/posts/123, DELETE http://my.api.url/posts/456, DELETE http://my.api.url/posts/789
1920
*
2021
* @example
2122
*

0 commit comments

Comments
 (0)