Skip to main content
EuroCargo
All field notes

Wiring rail tracking into 1C with four endpoints and one common module

A client asked for the status of a train inside their sales order. It took an afternoon, and the reason it took an afternoon is worth writing down.

Piotr Nowak

Platform Engineer

Published: 4 November 2026

10 min read

Most of the companies shipping on this corridor already keep their logistics records somewhere else. In Poland, Kazakhstan and the wider CIS that place is very often 1C:Enterprise, and the correct architecture is not to move anyone anywhere: it is to let 1C ask us a question and get a good answer. What follows is the whole integration, including the parts that are not code.

The shape of the answer

One endpoint does the work. GET /api/v1/track/{id}.json returns the shipment record, the resolved stops with coordinates, the legs with gauge-exchange data, and the event history. A client that only wants a status field can read one property; a client that wants to draw a progress rail already has everything except the drawing.

{
  "shipment": {
    "id": "EC-448127",
    "status": "in_transit",
    "position": 0.58,
    "etaAt": "2026-12-03T20:52:00+01:00"
  },
  "summary": { "remainingKm": 4120, "stopsDone": 5, "stopsTotal": 8 }
}

Two decisions in that payload saved us weeks of support. The first: status is a closed set of six values, and a client maps them to their own codes once instead of parsing text forever. The second: position is a fraction of the route as scheduled, not a fraction of elapsed calendar time. A train that stands for nineteen hours at an exchange does not look like it is moving because the clock is running.

The module

One common module, no external library, no OData client. HTTPСоединение and a WebObject are in the platform since 8.3.15, which covers every configuration our clients run.

Function EuroCargoTrack(Id, Key) Export

    Conn = New HTTPConnection("eurocargo.asia", 443, , "/api/v1/track/" + Id + ".json");
    H = Conn.RequestHeaders();
    H.Insert(New HTTPRequestHeader("Authorization", "Bearer " + Key));
    H.Insert(New HTTPRequestHeader("Accept", "application/json"));

    Resp = Conn.GetGetResponse();
    Doc  = New TextDocument;
    Doc.Read(Resp.GetBodyReader());

    If Resp.StatusCode = 404 Then
        Return New Structure("Known", False);
    EndIf;

    Json = New WebObject;
    Json.FromJSON(Doc.GetContent());

    Return New Structure(
        "Known", True,
        "Status", Json.shipment.status,
        "Position", Json.shipment.position,
        "Eta", Json.shipment.etaAt,
        "RemainingKm", Json.summary.remainingKm);

EndFunction

Where to put the call

The wrong answer is "when a user opens the form". That makes a fifteen-second HTTP round trip sit between a person and their screen, and it means the answer depends on whether our service is awake at that moment. The right answer is a scheduled job.

  1. 1A register of shipments holds the EC identifier against the sales order. It is written when the booking is confirmed, and it is the only new structure the client needs.
  2. 2A registrator job runs every forty minutes, reads the register, calls the endpoint for each open identifier and writes the result into a second register. The job is the only place that talks to the network.
  3. 3The sales order form reads the register. It is a database read, so it opens instantly, and it shows the value as of the last job run — which the form displays, because a status without a timestamp is a rumour.

The four things that go wrong

  • Timeouts set too short. The default 30 seconds is fine; a 5-second limit that a dispatcher once asked for produces failures on exactly the trains that matter, because a slow response usually means a large event history.
  • Treating 404 as an error. A 404 means the identifier is not on this account. It is an answer. Log it as a data-quality event, not as a connection failure, or the operations team will stop reading the log.
  • Comparing timestamps as strings. Our times carry the local offset of the reporting terminal — 01:52+08:00 from Xi'an is a real moment, not a formatting choice. Parse to an absolute instant before you compare anything.
  • Writing back on every poll. Compare the status you received with the status in the register and write only a change. Otherwise the register fills with forty-minute copies of the same truth and the audit trail becomes noise.

What the webhook is for

Polling is right for a sales order that a human reads. It is wrong for a warehouse that needs to know the moment a container is released, and that is what the webhook is for: a signed POST on every status transition, with the same codes, retried with exponential backoff for twenty-four hours and replayable from the cabinet if the endpoint was down.

Signature verification is the part people skip. Verify HMAC-SHA256 over the raw body with the endpoint secret before you act on the payload, and accept the delivery only once you have. A status change that arrives unsigned is a stranger telling you your goods cleared customs.

“The integration took an afternoon, and the afternoon included the meeting where we decided which of our own status codes to stop using.”

IT Logistics Manager, Almaty, after go-live

We publish a test data set with ten shipments and the same sample identifiers the public tracking page offers, so your module can be tested against a payload that will not change under you. An integration test that fails because a train really moved is not a test.

Topics:API1C:EnterpriseIntegration

Next on the corridor

Put a number on the uncertainty

Send us one SMGS reference and we will return a live record for your next China–Europe train, on the same feed that powers the API.

ops@eurocargo.asia · 21 /week