Skip to content

Commit d7869fd

Browse files
committed
update
1 parent be39466 commit d7869fd

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,7 @@ You can enable the following middleware using the "middlewares" config parameter
604604
- "pageLimits": Restricts list operations to prevent database scraping
605605
- "joinLimits": Restricts join parameters to prevent database scraping
606606
- "customization": Provides handlers for request and response customization
607+
- "xml": Translates all input and output from JSON to XML
607608

608609
The "middlewares" config parameter is a comma separated list of enabled middlewares.
609610
You can tune the middleware behavior using middleware specific configuration parameters:
@@ -667,6 +668,7 @@ You can tune the middleware behavior using middleware specific configuration par
667668
- "joinLimits.records": The maximum number of records returned for a joined entity ("1000")
668669
- "customization.beforeHandler": Handler to implement request customization ("")
669670
- "customization.afterHandler": Handler to implement response customization ("")
671+
- "xml.objectElement": The XML element name to use for objects ("object")
670672

671673
If you don't specify these parameters in the configuration, then the default values (between brackets) are used.
672674

@@ -1036,6 +1038,18 @@ You may use the "customization" middleware to modify request and response and im
10361038

10371039
The above example will add a header "X-Time-Taken" with the number of seconds the API call has taken.
10381040

1041+
### XML middleware
1042+
1043+
You may use the "xml" middleware to translate input and output from JSON to XML. This request:
1044+
1045+
GET /records/posts/1?format=xml
1046+
1047+
Gives this outputs (it uses a "format" query parameter):
1048+
1049+
<object><id>1</id><user_id>1</user_id><category_id>1</category_id><content>blog started</content></object>
1050+
1051+
This functionality is disabled by default and must be enabled using the "middlewares" configuration setting.
1052+
10391053
### File uploads
10401054

10411055
File uploads are supported through the [FileReader API](https://caniuse.com/#feat=filereader), check out the [example](https://github.com/mevdschee/php-crud-api/blob/master/examples/clients/upload/vanilla.html).

0 commit comments

Comments
 (0)