cURL is a fully featured command line HTTP client application that can be used to test all aspects of the RESTfm API without writing a line of code. Where a web browser can be used to test URIs with the HTTP method GET, cURL can be used to test all available HTTP methods.

cURL is available for many operating systems, and is free to download from here: http://curl.haxx.se/download.html

OSX comes with cURL installed by default, and Linux distributions will have it available in their repository.

Before attempting to use any of these examples please ensure that you have found the current credentials as listed on the Demo page.

Create (POST)

Layout URI - JSON - POST Message

1
2
3
4
5
6
7
8
{
    "data": [
        {
            "Pcode": "9999",
            "Locality": "A New Location"
        }
    ]
}
Example JSON format HTTP POST message.

With the above JSON in a file named: post.json

curl -i -X POST -u username:password -d @post.json -H "Content-Type: application/json" "http://demo.restfm.com/RESTfm/postcodes/layout/brief%20postcodes.json"

Note: the response is not shown, but in this example a new record was created with recordID = 5934297

Read (GET)

curl -i -X GET -u username:password "http://demo.restfm.com/RESTfm/postcodes/layout/brief%20postcodes/5934297.json"

Update (PUT)

Record URI - JSON - PUT Message

1
2
3
4
5
6
7
{
    "data": [
        {
            "Locality": "Updated Location"
        }
    ]
}
Example JSON format HTTP PUT message.

With the above JSON in a file named: put.json

curl -i -X PUT -u username:password -d @put.json -H "Content-Type: application/json" "http://demo.restfm.com/RESTfm/postcodes/layout/brief%20postcodes/5934297.json"

Delete (DELETE)

curl -i -X DELETE -u username:password "http://demo.restfm.com/RESTfm/postcodes/layout/brief%20postcodes/5934297.json"