API getting started

Page last updated: Monday, 15 October 2018 - 1:43pm

The API's all offer a test harness to make it easy to start to interact with them, but you need to be a registered user to obtain an API Key.

Please be aware of the Terms and Conditions for use of DPIRD APIs.

API How to use.

Please email our eConnected Grainbelt Project team at: eConnectedGrainbelt@dpird.wa.gov.au to obtain an API key.

Note, that your old API keys will not work with the new and updated versions of the APIs. Please email us to request a new one.

Once you have an API key you can then call the API service from whatever technology you are using. To simply test you can use a simple command line utility called 'cURL'. curl is available by default on Linux operating systems but for windows you can download an installation to install the additional library http://curl.haxx.se/

To test the service you can then type the following from a command line.

curl -X GET -k -H "api-key:yourkeyhere" "https://api.agric.wa.gov.au/v1/weatherstations.json"

Example response

  "result": [
      "station_id": "MP",
      "name": "Manypeaks",
      "latitude": "-34.76794444",
      "longitude": "118.2245556",
      "station_owner": "Department of Agriculture and Food",
      "start_date": "1993-05-04",
      "end_date": ""
      "station_id": "RA",
      "name": "Ravensthorpe",
      "latitude": "-33.435863",
      "longitude": "119.730175",
      "station_owner": "Department of Agriculture and Food",
      "start_date": "1999-12-16",
      "end_date": ""

If the API Key is valid you will get the data returned in the format expected. An invalid API Key will return an 'Unauthorised response' ;

Example: Unauthorised response

    "error": {
        "code": 401,
        "message": "Unauthorized"
    "debug": {
        "source": "Restler.php:891 at authenticate stage",
        "stages": {
            "success": [
            "failure": [