View on GitHub

easitrace

« Back to Contents

Transactions | Submitting

The main reason for EasiTrace is to allow applications to submit transactions to various movement services. This section describes the flow required by your application to submit transactions to a movement service, however most of the requests return static data which can be safely cached for subsequent requests.

Get Service Fields

Not every movement service requires (or can receive) the same information. For this reason, the transaction model which your application posts to EasiTrace contains a fields property which is an object of key-value pairs for the movement service specific data.

GET /api/services/{serviceId}/fields

To get the list of all fields which are available for a given service, use the above endpoint with the service ID of the service for which you want to get the fields. This ID can be retrieved from the result of /api/services endpoint shown in the Service Provider Setup section above.

Error Codes

Transactions which are submitted may return errors or warnings as part of the response, these error codes, severity and categories are documented seperately here: wiki/Error-Codes
However the model for all errors and warnings is:

{
  "code": "string",
  "field": "string",
  "description": "string",
  "category": "integer", // see table of error categories
  "severity": "integer", // see table of error severity
  "specificError": {
    "code": "string",
    "field": "string",
    "description": "string",
    "category": "integer",
    "severity": "integer",
  }
}

Transaction Model

All transactions which are sent to EasiTrace use the same base model as well as a fields property which contains fields specific to the movement service belonging to the property.

Submission Model

{
  "reference": "my reference",
  "transactionDate": "2019-01-31T22:26:47.075+00:00",
  "type": "REG",
  "speciesCode": "C",
  "propertyIdentifier": "20/002/0001",
  "fields": {
    ...
  },
  "animals": [
    {
      "rfid": "111222333",
      "visual": "UK590066700057",
      "birthDate": "2004-03-09",
      "breedCode": "HF",
      "sexCode": "F",
      "damOfficialId": "UK590066300249",
      "sireOfficialId": "UK H3796 00006"
    }
  ]
}

When the submission is returned the serviceInformation property will contain the tag of the service that the transaction was submitted to, for example:

"serviceInformation": {
  "service": "BCMS"
}

Response Model

{
  "id": "fab37ad4-017e-49fc-b16f-3e2efc707475",
  "reference": "my reference",
  "dateSubmitted": "2019-09-18T01:00:37.8461836+00:00",
  "transactionDate": "2019-01-31T22:26:47.075+00:00",
  "type": "REG",
  "speciesCode": "C",
  "propertyIdentifier": "20/002/0001",
  "serviceInformation": {
    "service": "BCMS",
    "movementId": "552037"
  },
  "lastUpdated": "2019-09-18T01:01:36.5291613+00:00",
  "status": "FAILURE",
  "headCount": null,
  "errors": [
    {
      "code": "MS-1000",
      "category": 5,
      "severity": 6,
      "description": "No Animals Accepted",
      "field": null,
      "specificError": {
        "code": null,
        "category": 0,
        "severity": 0,
        "description": null,
        "field": null,
        "specificError": null
      }
    }
  ],
  "warnings": [],
  "fields": {
    "BCMS.Register.BirthLocation": "20/002/0001",
    "BCMS.Register.PostalLocation": "01/001/0001-04"
  },
  "animals": [
    {
      "rfid": "111222333",
      "newRFID": null,
      "visual": "UK590066700057",
      "birthDate": "2004-03-09T00:00:00",
      "breedCode": "HF",
      "breedId": null,
      "sexCode": "F",
      "sexId": null,
      "damOfficialId": "UK590066300249",
      "surrogateDamOfficialId": null,
      "sireOfficialId": null,
      "errors": [
        {
          "code": "MS-1010",
          "category": 8,
          "severity": 6,
          "description": null,
          "field": null,
          "specificError": {
            "code": "CTWS184",
            "category": 0,
            "severity": 0,
            "description": "Birth Dam is not registered",
            "field": "Birth Dam Eartag",
            "specificError": null
          }
        }
      ],
      "fields": null,
      "timestamp": null,
      "iWarn": false,
      "tagInfo": null,
      "latestMovementInfo": null
    }
  ],
  "untaggedAnimals": null
}