Uptime-Kuma-Web-API icon indicating copy to clipboard operation
Uptime-Kuma-Web-API copied to clipboard

Error When Creating 'json-query' Type Monitor Using API

Open alencarsouza opened this issue 1 year ago • 0 comments

Overview:

I encountered an error while attempting to create a monitor of type json-query through the [POST] /monitors API endpoint.

Request Details:

I sent the following JSON payload in the request body:

  {
      "name": "example-monitor",
      "url": "mydomain.com/v1/health",
      "method": "GET",
      "maxretries": 1,
      "type": "json-query",
      "timeout": 10,
      "interval": 60,
      "retryInterval": 20,
      "resendInterval": 0,
      "maxredirects": 10,
      "accepted_statuscodes": ["200-299"],
      "dns_resolve_type": "A",
      "dns_resolve_server": "1.1.1.1",
      "httpBodyEncoding": "json",
      "jsonPath": "msg",
      "expectedValue": "ok"
  }

Error Received:

  {
    "detail": [
      {
        "loc": ["body", "type"],
        "msg": "value is not a valid enumeration member; permitted: 'http', 'port', 'ping', 'keyword', 'grpc-keyword', 'dns', 'docker', 'push', 'steam', 'gamedig', 'mqtt', 'sqlserver', 'postgres', 'mysql', 'mongodb', 'radius', 'redis'",
        "type": "type_error.enum",
        "ctx": {
          "enum_values": [
            "http",
            "port",
            "ping",
            "keyword",
            "grpc-keyword",
            "dns",
            "docker",
            "push",
            "steam",
            "gamedig",
            "mqtt",
            "sqlserver",
            "postgres",
            "mysql",
            "mongodb",
            "radius",
            "redis"
          ]
        }
      }
    ]
  }

Query:

Is json-query not a supported monitor type, or could this be an issue with the API or my request format? Any guidance or solutions to enable creating a monitor of type json-query would be highly appreciated.

Thank you for your assistance!

alencarsouza avatar Oct 26 '23 11:10 alencarsouza