View on GitHub

easitrace

« Back to Contents

Movement Services | EIDCymru

Overview

EIDCymru is the Wales Electronic Identification system for managing sheep and goat movements. The service provides capabilities for recording animal movements, cancelling movements, updating movement information, and retrieving historical movement data. EIDCymru supports sheep, goats, and deer species with CPH (Common Land Animal Property Identification Holding) property identifiers specific to Wales.

Service Type: EIDCYMRU
Region: Wales
Supported Species: Sheep, Goats, Deer
Property Identifier Format: CPH (00/000/0000)
Authentication: Username/Password + Application Credentials
SOAP Namespace: https://ews.eidcymru.org/ews/


Capabilities Overview

Transaction Type Code Primary Use Request Response
Movement On (Create) CreateMovement Record arrival of animals at destination CreateMovementRequest_Structure CreateMovementResponse_Structure
Movement Off (Complete) UpdateMovement Record departure of animals from farm UpdateMovementRequest_Structure UpdateMovementResponse_Structure
Update Movement Off UpdateMovement Update existing movement off record UpdateMovementRequest_Structure UpdateMovementResponse_Structure
Complete Movement AcceptMovement Accept/complete incoming movement AcceptMovementRequest_Structure AcceptMovementResponse_Structure
Cancel Movement DeleteMovement Cancel an existing movement DeleteMovementRequest_Structure DeleteMovementResponse_Structure
Get Incoming Movements GetOutstandingMovements Query pending incoming movements GetOutstandingMovementsRequest_Structure GetOutstandingMovementsResponse_Structure
Get History GetHistory Query historical movements GetHistoryRequest_Structure GetHistoryResponse_Structure

Field Keys Explanation

Generic vs. Specific Field Keys

EIDCymru field keys follow a namespace pattern that distinguishes between generic (service-independent) and specific (EIDCymru-specific) field keys:

When adding fields to a transaction, either the generic or specific key can be used. The system automatically maps between them.

Core Field Key Namespaces

Movement Fields (EIDCymru.Movement.*)

Field Key Type Description Example
EIDCymru.Movement.Id GUID Unique movement identifier 1073049
EIDCymru.Movement.DepartureDate Date Date of departure (YYYY-MM-DD) 2017-09-01
EIDCymru.Movement.DepartureTime Time Time of departure (HH:MM) 14:30
EIDCymru.Movement.DepartureLocation CPH Departure farm CPH identifier 52/111/0113
EIDCymru.Movement.DepartureName String Contact name at departure John Smith
EIDCymru.Movement.DepartureStreet String Departure address street Farm Lane
EIDCymru.Movement.DepartureLocality String Departure address locality Near Town
EIDCymru.Movement.DepartureTown String Departure address town Cardiff
EIDCymru.Movement.DepartureCounty String Departure address county Glamorgan
EIDCymru.Movement.DeparturePostcode String Departure postcode CF11 9TN
EIDCymru.Movement.DepartureEmail Email Departure contact email farmer@example.com
EIDCymru.Movement.DepartureActivity String Type of activity at departure Farm
EIDCymru.Movement.DestinationLocation CPH Destination CPH identifier 53/047/0046
EIDCymru.Movement.DestinationStreet String Destination address street Market Road
EIDCymru.Movement.DestinationLocality String Destination address locality Industrial Area
EIDCymru.Movement.DestinationTown String Destination address town Swansea
EIDCymru.Movement.DestinationCounty String Destination address country Wales
EIDCymru.Movement.DestinationPostcode String Destination postcode SA1 8PN
EIDCymru.Movement.DestinationEmail Email Destination contact email buyer@example.com
EIDCymru.Movement.LoadingDate Date Date animals loaded (YYYY-MM-DD) 2017-09-01
EIDCymru.Movement.ArrivalDate Date Expected/actual arrival date 2017-09-02
EIDCymru.Movement.UnloadingDate Date Date animals unloaded 2017-09-02
EIDCymru.Movement.DeadOnArrivalCount Integer Number of dead animals on arrival 0
EIDCymru.Movement.MovementQty Integer Total quantity of animals 2
EIDCymru.Movement.ExternalReference GUID External reference (optional) 00000000-0000-0000-0000-000000000000
EIDCymru.Movement.Reference String Movement reference MOV-001
EIDCymru.Movement.ReadLocation Char Location where animals read (D=Departure) D
EIDCymru.Movement.OffExemptionCode String Exemption code for movement off EX01
EIDCymru.Movement.OnExemptionCode String Exemption code for movement on EX02

Haulier Fields (EIDCymru.Movement.Haulier.*)

Field Key Type Description Example
EIDCymru.Movement.Haulier.Name String Haulier driver name Dave Wilson
EIDCymru.Movement.Haulier.CompanyName String Haulier company name Road Transport Ltd
EIDCymru.Movement.Haulier.RegistrationNumber String Haulier registration number ABC123456
EIDCymru.Movement.Haulier.PermitNumber String Transport permit number PERMIT-001
EIDCymru.Movement.Haulier.ExpectedDuration String Expected transport duration 2 hours

History Query Fields (EIDCymru.History.*)

Field Key Type Description Example
EIDCymru.History.DepartureDateFrom Date Start date for history query 2017-09-01
EIDCymru.History.DepartureDateTo Date End date for history query 2017-12-01
EIDCymru.History.DepartureLocation CPH Filter by departure CPH 52/111/0113
EIDCymru.History.DestinationLocation CPH Filter by destination CPH 60/057/4502
EIDCymru.History.Page Integer Page number for pagination 1
EIDCymru.History.NumRecords Integer Total records returned 9
EIDCymru.History.NumPages Integer Total pages available 2
EIDCymru.History.CurrentPage Integer Current page number 1
EIDCymru.History.LastPage String Is this the last page? (Yes/No) Yes
EIDCymru.History.Response String Raw response data {...}

Transaction Types

1. Movement On (MOV-ON)

Represents an animal arrival at a destination property. This transaction records the animals arriving at the destination after being transported from a departure location.

Required Fields

Field Key Type Pattern/Constraint Example
EIDCymru.Movement.DepartureCph CPH \d{2}/\d{3}/\d{4} 52/111/0113
EIDCymru.Movement.DestinationCph CPH \d{2}/\d{3}/\d{4} 53/047/0046
EIDCymru.Movement.DepartureDate Date ISO 8601 (YYYY-MM-DD) 2017-09-01
EIDCymru.Movement.MovementQty Integer > 0 2
Animal Tags Array EID format See Examples

Optional Fields

Field Key Type Description
EIDCymru.Movement.DepartureTime Time Departure time HH:MM
EIDCymru.Movement.LoadingDate Date When animals were loaded
EIDCymru.Movement.ArrivalDate Date Expected arrival date
EIDCymru.Movement.UnloadingDate Date When animals were unloaded
EIDCymru.Movement.DeadOnArrivalCount Integer Dead animals on arrival
EIDCymru.Movement.ExternalReference GUID External system reference
EIDCymru.Movement.ReadLocation Char Read location (D=Departure)
Haulier Fields String Transport company details

JSON Example - Movement On Request

{
  "transactionDate": "2017-09-11T16:51:02.3344561+00:00",
  "transactionType": "MoveOn",
  "propertyIdentifier": "53/047/0046",
  "speciesCode": "S",
  "fields": {
    "EIDCymru.Movement.DepartureDate": "2017-09-01",
    "EIDCymru.Movement.DepartureTime": "00:00",
    "EIDCymru.Movement.DepartureCph": "52/111/0113",
    "EIDCymru.Movement.DestinationCph": "53/047/0046",
    "EIDCymru.Movement.LoadingDate": "2017-09-01",
    "EIDCymru.Movement.MovementQty": "2",
    "EIDCymru.Movement.ReadLocation": "D",
    "EIDCymru.Movement.ExternalReference": "00000000-0000-0000-0000-000000000000"
  },
  "animals": [
    {
      "tagId": "1 0 04 00 0 826 0224589 00001",
      "tagType": "eid",
      "readDate": "2017-09-01T00:00:00"
    },
    {
      "tagId": "1 0 04 00 0 826 0224589 00002",
      "tagType": "eid",
      "readDate": "2017-09-01T00:00:00"
    }
  ]
}

2. Movement Off (MOV-OFF)

Records the departure of animals from a farm location. This creates a new movement transaction for outbound animals.

Required Fields

Field Key Type Pattern/Constraint Example
EIDCymru.Movement.DepartureCph CPH \d{2}/\d{3}/\d{4} 52/111/0113
EIDCymru.Movement.DestinationCph CPH \d{2}/\d{3}/\d{4} 53/047/0046
EIDCymru.Movement.DepartureDate Date ISO 8601 (YYYY-MM-DD) 2017-09-01
EIDCymru.Movement.MovementQty Integer > 0 2
Animal Tags Array EID format See Examples

Optional Fields

Field Key Type Description
EIDCymru.Movement.DepartureTime Time Departure time HH:MM
EIDCymru.Movement.LoadingDate Date Loading date
EIDCymru.Movement.ExternalReference GUID External reference
EIDCymru.Movement.ReadLocation Char Read location (D=Departure)
Destination Details String Destination address/contact
Haulier Information String Transport company details

JSON Example - Movement Off Request

{
  "transactionDate": "2017-09-11T16:51:02.3344561+00:00",
  "transactionType": "MoveOff",
  "propertyIdentifier": "52/111/0113",
  "speciesCode": "S",
  "fields": {
    "EIDCymru.Movement.DepartureDate": "2017-09-01",
    "EIDCymru.Movement.DepartureTime": "10:00",
    "EIDCymru.Movement.DepartureCph": "52/111/0113",
    "EIDCymru.Movement.DestinationCph": "53/047/0046",
    "EIDCymru.Movement.LoadingDate": "2017-09-01",
    "EIDCymru.Movement.MovementQty": "2",
    "EIDCymru.Movement.ReadLocation": "D",
    "EIDCymru.Movement.Haulier.CompanyName": "Road Transport Ltd"
  },
  "animals": [
    {
      "tagId": "1 0 04 00 0 826 0224589 00001",
      "tagType": "eid"
    },
    {
      "tagId": "1 0 04 00 0 826 0224589 00002",
      "tagType": "eid"
    }
  ]
}

3. Update Movement Off (UPDATEMOV-OFF)

Updates an existing outbound movement record with revised information.

Required Fields

Field Key Type Description Example
EIDCymru.Movement.Id String Movement ID to update 1234
EIDCymru.Movement.DepartureCph CPH Current departure CPH 52/111/0113
EIDCymru.Movement.DestinationCph CPH Current destination CPH 53/047/0046

Updatable Fields

Movement data can be updated such as:

JSON Example - Update Movement Off

{
  "transactionDate": "2017-09-11T16:51:02.3344561+00:00",
  "transactionType": "UpdateMovementOff",
  "propertyIdentifier": "52/111/0113",
  "speciesCode": "S",
  "fields": {
    "EIDCymru.Movement.Id": "1234",
    "EIDCymru.Movement.DepartureCph": "52/111/0113",
    "EIDCymru.Movement.DestinationCph": "53/047/0046",
    "EIDCymru.Movement.DepartureDate": "2017-09-01",
    "EIDCymru.Movement.DepartureTime": "10:00",
    "EIDCymru.Movement.LoadingDate": "2017-09-01",
    "EIDCymru.Movement.MovementQty": "2",
    "EIDCymru.Movement.Haulier.CompanyName": "Road Transport Ltd"
  }
}

4. Complete Movement (MOV-ON)

Confirms receipt of an incoming movement at the destination property.

Required Fields

Field Key Type Description Example
EIDCymru.Movement.Id String Movement ID to complete 1234
EIDCymru.Movement.ArrivalDate Date Actual arrival date 2017-09-02

JSON Example - Complete Movement

{
  "transactionDate": "2017-09-29T12:15:03.7639086+00:00",
  "transactionType": "CompleteMovement",
  "propertyIdentifier": "53/047/0046",
  "speciesCode": "S",
  "fields": {
    "EIDCymru.Movement.Id": "1234",
    "EIDCymru.Movement.ArrivalDate": "2017-09-25"
  }
}

5. Cancel Movement (MOV-DEL)

Cancels a previously recorded movement.

Required Fields

Field Key Type Description Example
EIDCymru.Movement.Id String Movement ID to cancel 1073049
EIDCymru.Movement.DepartureCph CPH Departure CPH 52/111/0113
EIDCymru.Movement.DestinationCph CPH Destination CPH 60/057/4502

JSON Example - Cancel Movement

{
  "transactionDate": "2017-09-29T12:39:08.8667695+00:00",
  "transactionType": "CancelMovement",
  "propertyIdentifier": "52/111/0113",
  "speciesCode": "S",
  "fields": {
    "EIDCymru.Movement.Id": "1073049",
    "EIDCymru.Movement.DepartureCph": "52/111/0113",
    "EIDCymru.Movement.DestinationCph": "60/057/4502"
  }
}

6. Get Incoming Movements (MOV-IN)

Retrieves list of pending/outstanding incoming movements for a property.

Request Fields

Field Key Type Description Example
EIDCymru.History.Page Integer Page number for pagination 1

Response Fields

Returned movements include:

Field Type Description
Mid String Movement ID
DepartureCph CPH Departure property CPH
DestinationCph CPH Destination property CPH
DepartureDate Date Departure date
MovementSpecies Integer Species code (4=Sheep, 44=Goat, 60=Deer)
MovementQty Integer Number of animals

JSON Example - Get Incoming Movements

{
  "transactionDate": "2017-09-29T12:39:08.8667695+00:00",
  "transactionType": "GetIncomingMovements",
  "propertyIdentifier": "53/047/0046",
  "speciesCode": "S",
  "fields": {
    "EIDCymru.History.Page": "1"
  }
}

Response Example

{
  "status": "Success",
  "numRecords": 3,
  "numPages": 1,
  "currentPage": 1,
  "lastPage": true,
  "movements": [
    {
      "movementId": "18988",
      "departureCph": "52/111/0113",
      "destinationCph": "53/047/0046",
      "departureDate": "2017-02-01",
      "species": "Sheep",
      "speciesCode": 4,
      "quantity": 1
    },
    {
      "movementId": "40440",
      "departureCph": "52/111/0114",
      "destinationCph": "53/047/0046",
      "departureDate": "2017-03-15",
      "species": "Sheep",
      "speciesCode": 4,
      "quantity": 2
    },
    {
      "movementId": "50123",
      "departureCph": "52/111/0115",
      "destinationCph": "53/047/0046",
      "departureDate": "2017-04-20",
      "species": "Goats",
      "speciesCode": 44,
      "quantity": 5
    }
  ]
}

7. Get History (Query Movement History)

Retrieves historical movement records based on date and CPH filters.

Query Fields

Field Key Type Required Description Example
EIDCymru.History.DepartureDateFrom Date Yes Start date for query (YYYY-MM-DD) 2017-09-01
EIDCymru.History.DepartureDateTo Date Yes End date for query (YYYY-MM-DD) 2017-12-01
EIDCymru.History.DepartureLocation CPH No Filter by departure CPH 52/111/0113
EIDCymru.History.DestinationLocation CPH No Filter by destination CPH 60/057/4502
EIDCymru.History.Page Integer No Page number (default: 1) 1

Response Fields

Returns pagination info and list of matching movements:

Field Type Description
NumRecords Integer Total records found
NumPages Integer Total pages available
CurrentPage Integer Current page number
LastPage String “Yes”/”No” if last page
Movements[].Mid String Movement ID
Movements[].DepartureCph CPH Departure CPH
Movements[].DestinationCph CPH Destination CPH
Movements[].DepartureDate Date Departure date
Movements[].MovementSpecies Integer Species code
Movements[].MovementQty Integer Animal count

JSON Example - Get History Request

{
  "transactionDate": "2017-09-29T12:39:08.8667695+00:00",
  "transactionType": "GetHistory",
  "propertyIdentifier": "52/111/0113",
  "speciesCode": "S",
  "fields": {
    "EIDCymru.History.DepartureDateFrom": "2017-09-01",
    "EIDCymru.History.DepartureDateTo": "2017-12-01",
    "EIDCymru.History.DepartureLocation": "52/111/0113",
    "EIDCymru.History.Page": "1"
  }
}

SOAP XML Example - Get History Request

<GetHistoryRequest_Structure xmlns="https://ews.eidcymru.org/ews/">
  <UserName>Stocktrace_keeper1</UserName>
  <Password>AFIx9M79h</Password>
  <ApplicationName>Gallagher Dashboard</ApplicationName>
  <ApplicationVersion>1.0</ApplicationVersion>
  <SchemaVersion>1.0</SchemaVersion>
  <Timestamp>2017-09-29T12:39:08.8667695</Timestamp>
  <History>
    <DepartureDateFrom>2017-09-01</DepartureDateFrom>
    <DepartureDateTo>2017-12-01</DepartureDateTo>
    <DepartureCph>52/111/0113</DepartureCph>
    <DestinationCph>60/057/4502</DestinationCph>
    <Page>1</Page>
  </History>
</GetHistoryRequest_Structure>

Response Example

<GetHistoryResponse_Structure xmlns="https://ews.eidcymru.org/ews/">
  <SubmissionId>29</SubmissionId>
  <Success>
    <Code/>
    <Description/>
    <NumRecords>9</NumRecords>
    <NumPages>1</NumPages>
    <CurrentPage>1</CurrentPage>
    <LastPage>Yes</LastPage>
  </Success>
  <History>
    <Movement>
      <Mid>18988</Mid>
      <MovementSpecies>4</MovementSpecies>
      <MovementQty>1</MovementQty>
      <DepartureCph>52/111/0113</DepartureCph>
      <DestinationCph>53/047/0046</DestinationCph>
      <DepartureDate>2016-02-01</DepartureDate>
    </Movement>
    <Movement>
      <Mid>40440</Mid>
      <MovementSpecies>4</MovementSpecies>
      <MovementQty>2</MovementQty>
      <DepartureCph>52/111/0113</DepartureCph>
      <DestinationCph>53/047/0046</DestinationCph>
      <DepartureDate>2017-02-01</DepartureDate>
    </Movement>
  </History>
</GetHistoryResponse_Structure>

Species Support

EIDCymru supports the following livestock species with their respective codes:

Species Code EIDCymru Code Supported
Sheep S 4 ✅ Yes
Goats G 44 ✅ Yes
Deer D 60 ✅ Yes

Species Code Mapping

The SpeciesMap class handles conversion between standard species codes and EIDCymru codes:

Species.Sheep  4
Species.Goats  44
Species.Deer  60

Property Identifier Format (CPH)

CPH (Common Land Animal Property Identification Holding)

EIDCymru uses the CPH format for property identification, specifically designed for Wales livestock properties.

Format Specification

Format Examples

Valid CPH Examples:

CPH Regional Codes (Wales)

CPH codes beginning with 5X are used for Wales properties:

Validation Rules

  1. Format Validation: Must match pattern ^\d{2}/\d{3}/\d{4}$
  2. Non-Empty: Cannot be null or empty
  3. Character Validation: Only digits (0-9) and forward slashes (/) allowed
  4. Segment Validation: All three segments required (cannot omit leading zeros)

CPH Usage in Transactions


Property Types

EIDCymru currently supports the following property types:

Property Type Code EIDCymru Code Description
Farm F 3 Agricultural holding/farm
Market M 4 Livestock market/trading location
Collection Centre CC 4 Animal collection point
Abattoir A 8 Slaughterhouse/meat processing plant

Property Type Code Mapping

The PropertyTypeMap class handles conversion:

PropertyType.Farm  3
PropertyType.Market  4
PropertyType.CollectionCentre  4
PropertyType.Abattoir  8

Authentication

Required Credentials

EIDCymru authentication requires the following credentials:

Credential Type Description Example
Username String User account username Stocktrace_keeper1
Password String User account password AFIx9M79h
ApplicationName String Name of calling application Gallagher Dashboard
ApplicationVersion String Version of calling application 1.0

Authentication Requirements

RequiredCredentials.ProgramName |        // Application name
RequiredCredentials.ProgramVersion |     // Application version
RequiredCredentials.PropertyUsername |   // Property/user username
RequiredCredentials.PropertyPassword     // Property/user password

SOAP Header Structure

Every SOAP request includes these header elements:

<UserName>Stocktrace_keeper1</UserName>
<Password>AFIx9M79h</Password>
<ApplicationName>Gallagher Dashboard</ApplicationName>
<ApplicationVersion>1.0</ApplicationVersion>
<SchemaVersion>1.0</SchemaVersion>
<Timestamp>2017-09-29T12:39:08.8667695</Timestamp>

Credential Validation

The UserCredentialValidator class validates user credentials by:

  1. Creating a test transaction with GetIncomingMovements capability
  2. Attempting to pack the transaction with provided credentials
  3. Sending a minimal request to EIDCymru service
  4. Verifying the response indicates success

Credentials are considered valid if the service returns a success response without authentication errors.

Service Configuration

EIDCymru settings are configured via the EIDCymruSettings class:


Response Handling

Response Status Codes

All EIDCymru responses include status information:

Status Meaning Description
Success All operations completed successfully No errors or warnings
Warning Operation completed with warnings Some issues but processed
Failure Operation failed One or more critical errors

Success Response Structure

<SubmissionId>12345</SubmissionId>
<Success>
  <Code>0</Code>
  <Description>Operation successful</Description>
</Success>

Error Response Structure

<SubmissionId>12345</SubmissionId>
<Error>
  <Code>ERR001</Code>
  <Description>Detailed error description</Description>
</Error>

Movement Response (Create/Update/Delete)

<Movement>
  <Mid>1073049</Mid>
  <!-- Additional movement details -->
</Movement>

Error Mapping

The EIDCymruErrorMapper class converts SOAP fault responses into standardized error responses. Common error scenarios include:


Implementation Notes

External Reference Generation

Movement transactions can include external references (typically GUIDs) for linking with external systems. The ExternalReferenceGenerator class creates properly formatted references:

// Auto-generated external reference format
00000000-0000-0000-0000-000000000000

Read Location

The ReadLocation field indicates where animals were electronically identified:

Value Meaning
D Departure - Read at origin farm
T Transport - Read during transit
A Arrival - Read at destination

Movement Type Codes

EIDCymru uses movement type codes to categorize transactions:

Code Movement Type Description
3 Farm to Farm Movement between two farm properties
4 To Market Movement to livestock market
8 To Abattoir Movement to slaughterhouse


Additional Resources


Last Updated: 2024
Document Version: 1.0
Service Status: Active ✅