Maurits van der Schee 4 years ago
parent
commit
d7869fd7fe
1 changed files with 14 additions and 0 deletions
  1. 14
    0
      README.md

+ 14
- 0
README.md View File

@@ -604,6 +604,7 @@ You can enable the following middleware using the "middlewares" config parameter
604 604
 - "pageLimits": Restricts list operations to prevent database scraping
605 605
 - "joinLimits": Restricts join parameters to prevent database scraping
606 606
 - "customization": Provides handlers for request and response customization
607
+- "xml": Translates all input and output from JSON to XML
607 608
 
608 609
 The "middlewares" config parameter is a comma separated list of enabled middlewares.
609 610
 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
667 668
 - "joinLimits.records": The maximum number of records returned for a joined entity ("1000")
668 669
 - "customization.beforeHandler": Handler to implement request customization ("")
669 670
 - "customization.afterHandler": Handler to implement response customization ("")
671
+- "xml.objectElement": The XML element name to use for objects ("object")
670 672
 
671 673
 If you don't specify these parameters in the configuration, then the default values (between brackets) are used.
672 674
 
@@ -1036,6 +1038,18 @@ You may use the "customization" middleware to modify request and response and im
1036 1038
 
1037 1039
 The above example will add a header "X-Time-Taken" with the number of seconds the API call has taken.
1038 1040
 
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
+
1039 1053
 ### File uploads
1040 1054
 
1041 1055
 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).

Loading…
Cancel
Save