RESTfm accepts flags and parameters to modify it's input parsing, data processing, and output behaviour.
RESTfm flags and parameters are identified by the prefix 'RFM', and may be supplied in three different locations in this descending order of priority:
- As URI query string parameters.
- As application/x-www-form-urlencoded or multipart/form-data parameters (only applicable to the HTPT POST method).
- As parameters inside the 'info' section of a formatted message (e.g. JSON, XML, etc.)
The only distinction between RESTfm flags and parameters is that flags have no argument (value). It is ok to assign a value to flags if desired, a good choice would be the number one '1'.
Example message, URI and response:
By utilising the echo service URI, the priority of RFM parameters may be demonstrated.
The above JSON is then URL encoded and passed as the RFMdata parameter in the encoding below.
Note: It is not a requirement to use this double encoding scheme to POST JSON data, it is just used here as a contrived example to demonstrate the three possible locations for RESTfm parameters and their priorities.
The final POST URI also contains RESTfm parameters. The response demonstrates the priority of the parameters as determined by RESTfm.