RESTfm allows HTTP methods (GET, POST, PUT, DELETE) to be overridden with a different method. This makes C.R.U.D. operations accessible to clients that implement only a subset of the available HTTP methods.

Commonly to use GET in place of POST, PUT and DELETE.

It is also possible to use POST in place of PUT.

Query string parameters

RFMmethod=POST|GET|PUT|DELETE Override called method and use this method to perform operation. May use method name aliases CREATE, READ, UPDATE, DELETE if preferred.
<fieldname>=<fieldvalue> Optional URL encoded field name and value pairs for submitting record data with GET.

Method name aliases

The method names POST, GET, PUT and DELETE are "HTTP methods". RESTfm provides easier to remember aliases CREATE, READ, UPDATE, DELETE (C.R.U.D.) as a convenience.

Known Limitations

When overriding GET to implement POST and PUT, the field data must be passed in as HTTP query string parameters. This imposes two limitations:

  1. There is a maximum length to the URI allowed in both HTTP client and server. There is no standard for this maximum and it varies between client and server implementations. This limits how much data may be submitted in the URI. A reasonably supported minimum appears to be 2000 bytes.
  2. Query string parameters beginning with the letters "RFM" are reserved for use in RESTfm. Any parameter that matches is stripped from the submitted data before processing.

Example: Override GET to implement DELETE

Normal DELETE operation:

curl -i -X DELETE -u username:password -k "https://localhost/RESTfm/postcodes/layout/thisLayout/7.xml"

Using GET with method override:

curl -i -X GET -u username:password -k "https://localhost/RESTfm/postcodes/layout/thisLayout/7.xml?RFMmethod=DELETE"

Example: Override GET to implement PUT

Field data for updating the record is normally contained in the PUT message data. When overriding GET the field data is passed in as URL encoded query string parameters.

Normal PUT message:

Record URI - XML - PUT Message

1
2
3
4
5
6
7
8
<?xml version="1.0" encoding="UTF-8"?>
<resource>
 <data>
  <row>
   <field name="Locality">Updated Location</field>
  </row>
 </data>
</resource>
Example XML format HTTP PUT message.

Normal PUT operation:

curl -i -X PUT -d @data.xml -u username:password -k "https://localhost/RESTfm/postcodes/layout/thisLayout/7.xml"

Using GET with method override:

curl -i -X GET -u username:password -k "https://localhost/RESTfm/postcodes/layout/thisLayout/7.xml?RFMmethod=PUT&Locality=Updated+location"

Example: Override POST to implement PUT

Field data for updating the record is normally contained in the PUT message body. When overriding POST the message body stays the same.

Normal PUT operation:

curl -i -X PUT -d @data.xml -u username:password -k "https://localhost/RESTfm/postcodes/layout/thisLayout/7.xml"

Using POST with method override:

curl -i -X POST -d @data.xml -u username:password -k "https://localhost/RESTfm/postcodes/layout/thisLayout/7.xml?RFMmethod=PUT"

Changelog

Version Description
3.0.0 Introduced CREATE, READ, UPDATE aliases for POST, GET, PUT methods.