View on GitHub

easitrace

« Back to Contents

Property Setup

Properties represent areas where animals are held and are specifically identified by the various movement services. To send transactions to EasiTrace, an application must have a property against which the transaction is applied. All requests made in this section, require the use of the Application access key generated in the previous section.

Getting Auxiliary Data

To create properties, there are a few fields that you must provide which are validated against a list of known values. These values are relatively static, so can be cached by the application. GET /api/species This endpoint gets the list of species known to EasiTrace. The species code is used in subsequent requests to identify the species.

Example Request

curl -X GET "https://test-api.easitrace.com/api/species" -H "accept: application/json" -H "X-API-Key: 35323339393942314131304632431679334135353936393344454530995545434135323232363535373942454332434236344235303933433238323932307419"

Example Response

{
  "count": 1,
  "items": [
    {
      "code": "S",
      "name": "Sheep"
    }
  ]
}

GET /api/countries This endpoint gets the list of countries known to EasiTrace. The country code is used to subsequent requests to identify the country.

Example Request

curl -X GET "https://test-api.easitrace.com/api/countries" -H "accept: application/json" -H "X-API-Key: 35323339393942314131304632431679334135353936393344454530995545434135323232363535373942454332434236344235303933433238323932307419"

Example Response

{
  "count": 1,
  "items": [
    {
      "code": "NZL",
      "name": "New Zealand"
    }
  ]
}

GET /api/properties/types This endpoint gets the list of property types known to EasiTrace. Certain property types are also only available in certain countries and this endpoint gives a list of countries in which each property is available.

Example Request

curl -X GET "https://test-api.easitrace.com/api/properties/types" -H "accept: application/json" -H "X-API-Key: 35323339393942314131304632431679334135353936393344454530995545434135323232363535373942454332434236344235303933433238323932307419"

Example Response

{
  "count": 1,
  "items": [
    {
      "code": "F",
      "name": "Farm",
      "countries": [
        "NZL"
      ]
    }
  ]
}

Creating a Property

POST /api/properties This endpoint creates a property within the authenticated application.

Model

{
  "reference": "string",
  "name": "string",
  "identifiers": [
    {
      "identifier": "string",
      "reference": "string",
      "speciesCode": "string"
    }
  ],
  "address": {
    "address1": "string",
    "address2": "string",
    "address3": "string",
    "address4": "string",
    "postCode": "string",
    "city": "string",
    "region": "string",
    "state": "string",
    "country": "string"
  },
  "species": [
    "string"
  ],
  "type": "string"
}

Model Notes

Example Request

curl -X POST "https://test-api.easitrace.com/api/properties" -H "accept: application/json" -H "X-API-Key: 35323339393942314131304632431679334135353936393344454530995545434135323232363535373942454332434236344235303933433238323932307419" -H "Content-Type: application/json" -d "{ \"reference\": \"PROP1\", \"name\": \"Property 1\", \"identifiers\": [ { \"identifier\": \"12345678\", \"reference\": \"ID1\", \"speciesCode\": \"C\" } ], \"address\": { \"address1\": \"A1\", \"address2\": \"A2\", \"address3\": \"A3\", \"address4\": \"A4\", \"postCode\": \"3210\", \"city\": \"C\", \"region\": \"R\", \"state\": \"S\", \"country\": \"NZL\" }, \"species\": [ \"C\" ], \"type\": \"F\"}"

Example Response

{
  "id": "b54b94aa-f11e-4bec-b71f-4ef69ce9a9c5",
  "reference": "PROP1",
  "name": "Property 1",
  "identifiers": [
    {
      "identifier": "12345678",
      "reference": "ID1",
      "speciesCode": "C"
    }
  ],
  "address": {
    "address1": "A1",
    "address2": "A2",
    "address3": "A3",
    "address4": "A4",
    "postCode": "3210",
    "city": "C",
    "region": "R",
    "state": "S",
    "country": "NZL"
  },
  "species": [
    "C"
  ],
  "type": "F"
}

POST /api/properties/{propertyId}/credentials

Most movement services require that credentials for the property to which a transaction relates, be supplied with the transaction message. This endpoint provides the mechanism for applications to supply those credentials to EasiTrace so they can be added to transactions sent to the movement services.

Model

{
  "username": "string",
  "password": "string",
  "speciesCode": "string",
  "serviceTag": "string"
}

_Model Notes

Example Request

curl -X POST "https://test-api.easitrace.com/api/properties/b54b94aa-f11e-4bec-b71f-4ef69ce9a9c5/credentials" -H "accept: application/json" -H "X-API-Key: 35323339393942314131304632431679334135353936393344454530995545434135323232363535373942454332434236344235303933433238323932307419" -H "Content-Type: application/json" -d "{ \"username\": \"username\", \"password\": \"password\", \"speciesCode\": \"C\"}"

Example Response

{
  "credentialsId": "089e91b9-68c4-41da-8dd2-6d87832c17d5"
}