Skip to content

Fix unit endpoint routes - #36

Open
jsachs wants to merge 1 commit into
ulfsri:mainfrom
jsachs:codex/fix-unit-routes
Open

Fix unit endpoint routes#36
jsachs wants to merge 1 commit into
ulfsri:mainfrom
jsachs:codex/fix-unit-routes

Conversation

@jsachs

@jsachs jsachs commented Aug 4, 2026

Copy link
Copy Markdown

Problem

The NERIS API defines these unit endpoints:

POST  /entity/{neris_id_entity}/station/{neris_id_station}/unit
PATCH /entity/{neris_id_entity}/station/{neris_id_station}/unit/{neris_id_unit}

The client’s create_unit method omitted /unit and instead posted to the station resource. This sends a unit payload to the wrong endpoint.

patch_unit also referenced an undefined neris_id variable when building its URL. Any call to this method raises NameError before making an HTTP request.

Fix

  • Send unit creation requests to the documented /unit collection route.
  • Build the unit patch route using the supplied neris_id_entity parameter.

Example

client.create_unit(
    "FD24027334",
    "FD24027334S001",
    {
        "staffing": 4,
        "type": "...",
        "cad_designation_1": "ENGINE 1",
    },
)

Now sends:

POST /entity/FD24027334/station/FD24027334S001/unit
client.patch_unit(
    "FD24027334",
    "FD24027334S001",
    "FD24027334S001U003",
    {"staffing": 5},
)

Now sends:

PATCH /entity/FD24027334/station/FD24027334S001/unit/FD24027334S001U003

Tests

  • Added regression tests for both generated routes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant