Several MIM API Endpoints return HTTP 400
-
All of these return
HTTP 400 {"errcode":400,"errmsg":"request handler failed"}
regardless of request body:Method Path GET/api/device/pfsense/{id}/api/systemGET/api/device/pfsense/{id}/api/system/update-infoGET/api/device/pfsense/{id}/api/system/update-info/settingsGET/api/device/pfsense/{id}/api/system/subsystem-dirtyPOST/api/device/pfsense/{id}/api/system/applyPOST/api/device/pfsense/{id}/api/system/applywith body{}POST/api/device/pfsense/{id}/api/system/applywith body{"subsystem":"aliases"}POST/api/device/pfsense/{id}/api/firewall/filter/reloadPOST/api/device/pfsense/{id}/api/firewall/filter/reloadwith body{}POST/api/device/pfsense/{id}/api/firewall/filter/syncPOST/api/device/pfsense/{id}/api/firewall/filter/syncwith body{}The same behavior is reproducible both against the controller itself
(device_id = localhost) and against a registered managed instance.Verified working endpoints (for contrast)
These endpoints on the same proxy prefix work correctly and return valid
data:Method Path Notes GET/api/login(actuallyPOST /api/login)JWT auth GET/api/controllerController telemetry GET/api/mim/devicesFull device list including sys_infoGET/api/device/pfsense/{id}/api/system/statusDirty-subsystem map returned inline GET/api/device/pfsense/{id}/api/system/firmwareReturns "system does not support firmware upgrade"on PlusGET/api/device/pfsense/{id}/api/aliasesFull alias list PUT/api/device/pfsense/{id}/api/aliasesCreates alias, idempotent by name POST/api/device/pfsense/{id}/api/aliases/{name}Updates alias DELETE/api/device/pfsense/{id}/api/aliases/{name}Deletes alias Reproduction (curl)
# 1. Login TOKEN=$(curl -sk -X POST "https://<controller>:8443/api/login" \ -H "Content-Type: application/json" \ -d "{\"username\":\"$(printf admin | base64)\",\"password\":\"$(printf <password> | base64)\"}" \ | jq -r .token) # 2. Baseline: GET aliases works -> HTTP 200 curl -sk -H "Authorization: Bearer $TOKEN" \ "https://<controller>:8443/api/device/pfsense/<device_id>/api/aliases" # 3. Affected: POST system/apply fails with 400 curl -sk -i -X POST -H "Authorization: Bearer $TOKEN" \ "https://<controller>:8443/api/device/pfsense/<device_id>/api/system/apply" # Response: # HTTP/1.1 400 Bad Request # {"errcode":400,"errmsg":"request handler failed"} # 4. Affected: GET subsystem-dirty fails identically curl -sk -i -H "Authorization: Bearer $TOKEN" \ "https://<controller>:8443/api/device/pfsense/<device_id>/api/system/subsystem-dirty" # Response: identical 400 bodyEnd-to-end scenario that breaks
A typical MIM-API automation workflow:
PUT /api/device/pfsense/{id}/api/aliases— creates a new alias on a
managed device. Succeeds. Alias lands inconfig.xml.POST /api/device/pfsense/{id}/api/system/apply— should commit the
change. Fails with 400.GET /api/device/pfsense/{id}/api/aliases— returns the active
ruleset, which does not yet include the newly created alias,
because it is still pending.- The alias becomes active only after a human operator clicks
"Apply Changes" in the managed device's WebGUI manually.
This breaks every automation flow that relies on applying remote
configuration changes via the API (alias rollout, update triggering,
reboot-on-change workflows). The same pattern applies to
POST /system/update, which we haven't yet reached — the prerequisite
GET /system/update-infofails, so we can't see whether the actual
upgrade call would also fail. -
It looks like this is more AI "assistance" since currently there's no
system/applyendpoint. You can read the docs at e.g.:
https://netgate.github.io/pfsense-api/#tag/system/operation/ApplyDirtyConfigFor any further discussion please create a new post after verifying the information yourself.
-
M marcosm locked this topic