URI /RESTfm/{database}/echo

The echo service URI takes submitted data (HTTP body and query string parameters), parses it with RESTfm's format handlers, and returns a readable representation of what it received. The echo service is intended to help development when diagnosing formatting issues. Developers will find the HttpRequester plugin for Firefox an invaluable tool for testing various formats and different HTTP methods with the echo service.

The echo service URI is only available when diagnostics is set to TRUE in RESTfm.ini.php.

GET example

In the following example three query string parameters are submitted to the echo URI. Parameters with the prefix 'RFM' are reserved for use with RESTfm, and appear under 'Parameters' in the response.

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'. So RFMflag=1 would have been acceptable in the example below.

Query string parameters that do not have the prefix 'RFM' are considered to be data for a single record in the form of FieldName = FieldValue pairs. This mechanism for submitting data is limited, but may be used with method override to perform basic CRUD operations, using only HTTP GET.

        RESTfm 3.0.0beta/r420 Echo Service
=========================================================
 
------------ Parameters -------------
RFMmethod="POST"
RFMflag=""
RFMparameter="example"
 
------------ Data -------------------
data:
  0:
    someField="someValue"
    otherField="anotherValue"
 
 
------------ RESTfm -----------------
request method=POST
response format=html
Example of RESTfm flags, parameters and record data submitted in a query string.

POST example

In the following example a single record is submitted in JSON format to the echo URI.

{
    "data": [
        {
            "Pcode": "9999",
            "Locality": "A New Location"
        }
    ]
}
Example JSON format HTTP POST message.
        RESTfm 3.0.0beta/r420 Echo Service
=========================================================
 
------------ Parameters -------------
 
------------ Data -------------------
data:
  0:
    Pcode="9999"
    Locality="A New Location"
 
 
------------ RESTfm -----------------
request method=POST
response format=json
Example echo respoonse to JSON format HTTP POST.

POST Bulk Operations example

In the following example multiple records are submitted in JSON format to the echo URI, including two different RFM flags.

{
    "data": [
        {
            "Pcode": "9998",
            "Locality": "A New Location 1"
        },
        {
            "Pcode": "9999",
            "Locality": "A New Location 2"
        }
    ],
    "info": {
        "RFMflag2": "1"
    }
}
Example JSON format Bulk HTTP POST message to echo URI.
        RESTfm 3.0.0beta/r420 Echo Service
=========================================================
 
------------ Parameters -------------
RFMflag2="1"
RFMflag1=""
 
------------ Data -------------------
data:
  0:
    Pcode="9998"
    Locality="A New Location 1"
  1:
    Pcode="9999"
    Locality="A New Location 2"
 
info:
 
 
------------ RESTfm -----------------
request method=POST
response format=json

Example echo response to JSON format Bulk HTTP POST.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us