Experimenting with the cURL command line client
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)
{ "data": [ { "Pcode": "9999", "Locality": "A New Location" } ] }
Example JSON format HTTP POST message.
With the above JSON in a file named: post.jsoncurl -i -X POST -u username:password -d @post.json -H "Content-Type: application/json" "http://demo.restfm.com/RESTfm/postcodes/layout/brief%20postcodes.json"
curl -i -X GET -u username:password "http://demo.restfm.com/RESTfm/postcodes/layout/brief%20postcodes/5934297.json"
Update (PUT)
{ "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"