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.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)

{
    "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"
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