Calling `mctl --reset` using RMS API `/devices/{id}/command` results in Timeout

I’m using the RMS API to run device actions. It is mostly working well, but I’m hitting a problem with the /devices/{id}/command endpoint.

When running certain commands, I get a Timeout response from the Status API, even though the command was successful (device ID set to 123456 in the examples below).

Example 1 — results in a Timeout

Command

curl \
--header "Authorization: Bearer {my_pat_token}" \
--header 'Content-Type: application/json' \
--data '{ "command": "mctl --reset" }' \
--url "https://rms.teltonika-networks.com/api/devices/123456/command"

Result

{
  "success": true,
  "data": {
    "123456": [
      {
        "status": "pending",
        "type": "text",
        "value": "Sending custom command..."
      },
      {
        "errorCode": 65545, //  |
        "status": "error",  //  APPEARS TO BE AN ERROR??
        "type": "text",     //  |
        "value": "Timeout." //  |
      }
    ]
  }
}

Example 2 — “Successful”

Command

curl \
--header "Authorization: Bearer {my_pat_token}" \
--header 'Content-Type: application/json' \
--data '{ "command": "api post /modems/3-1/actions/reboot" }' \
--url "https://rms.teltonika-networks.com/api/devices/123456/command"

Result

{
  "success": true,
  "data": {
    "123456": [
      {
        "status": "pending",
        "type": "text",
        "value": "Sending custom command..."
      },
      {
        "status": "completed",
        "type": "text",
        "value": "{\"http_body\":{\"success\":true},\"http_code\":200}\n"
      }
    ]
  }
}

I have tried running the first command as mctl --reset & to tell the shell not to wait for it to complete, but it does not help.

Is this a bug with the API, or am I somehow calling it incorrectly?

This topic was automatically closed after 15 days. New replies are no longer allowed.