Uploaded image for project: 'Help-Desk'
  1. Help-Desk
  2. HELP-23014

[fiware-stackoverflow] FIWARE IoT Agent-JSON Returns BAD_REQUEST When Provisioning Actuator with Commands (Context Broker 201 Error)

    Details

      Description

      Created question in FIWARE Q/A platform on 11-05-2025 at 16:05
      Please, ANSWER this question AT https://stackoverflow.com/questions/79616690/fiware-iot-agent-json-returns-bad-request-when-provisioning-actuator-with-comman

      Question:
      FIWARE IoT Agent-JSON Returns BAD_REQUEST When Provisioning Actuator with Commands (Context Broker 201 Error)

      Description:
      I'm encountering a 400 error when provisioning an actuator with command attributes using the FIWARE IoT Agent-JSON. The IoT Agent reports a Context Broker connection error despite Orion seemingly returning a 201 status. Can anyone help identify the misconfiguration?
      Setup:
      FIWARE Orion-LD Context Broker (v3.10.0)

      IoT Agent-JSON (v1.29.0)

      Using NGSI-v2 API for interactions

      Steps to Reproduce:
      Send device provisioning request to IoT Agent:

      POST /iot/devices
      {
      "devices": [
      {
      "device_id": "act012",
      "entity_name": "urn:ngsi-ld:act:012",
      "entity_type": "test",
      "transport": "HTTP",
      "endpoint": "http://iot-sensors:3001/iot/lamp001",
      "commands": [

      {"name": "on","type": "command"}

      ,

      {"name": "off","type": "command"}

      ],
      "attributes": [

      {"object_id": "s", "name": "state", "type":"Text"}

      ,

      {"object_id": "l", "name": "luminosity", "type":"Integer"}

      ],
      "static_attributes": [

      {"name":"refStore", "type": "Relationship","value": "urn:ngsi-ld:Store:001"}

      ]
      }
      ]
      }

      Response:

      400 Bad Request
      {
      "name": "BAD_REQUEST",
      "message": "Request error connecting to the Context Broker: 201"
      }

      IoT Agent Logs:
      The IoT Agent attempts to create a Context Broker registration:

      POST http://orion-proxy:1027/v2/registrations
      {
      "dataProvided": {
      "entities": [

      {"type": "test", "id": "urn:ngsi-ld:act:012"}

      ],
      "attrs": ["on", "off"]
      },
      "provider": {
      "http":

      {"url": "http://iot-agent:4041"}

      }
      }
      Headers: {
      "fiware-service": "openiot",
      "fiware-servicepath": "/",
      "Authorization": "Bearer ..."
      }

      What I've Tried:
      Verified Orion is reachable and returns 201 for direct registration requests

      Confirmed device endpoint is accessible

      Tested with both NGSI-v2 and NGSI-LD entity ID formats

      Simplified static attributes (removing Relationship type)

      Key Observations:
      Orion returns HTTP 201 (Created) for registration, but IoT Agent interprets this as an error

      Static attribute uses "type": "Relationship" - should this be "Reference" for NGSI-v2?

      Entity ID uses ngsi-ld prefix in NGSI-v2 registration

      Question:
      Why is the IoT Agent-JSON failing with BAD_REQUEST despite Orion's 201 response? Are there issues with my command definitions, registration payload, or type declarations?

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            newbacklogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: