Ad Widget

Collapse

Cannot execute API Calls

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • praths
    Junior Member
    • Jul 2025
    • 5

    #1

    Cannot execute API Calls


    Hello,

    I am running into an issue with the API on a fresh Zabbix 7.4.0 installation using the official Docker images on macOS.

    The Problem: Any authenticated API call using a permanent token fails with the error: {"code":-32600,"message":"Invalid request.","data":"Invalid parameter "/": unexpected parameter "auth"."}. However, an unauthenticated call to apiinfo.version on the exact same endpoint succeeds and correctly returns {"result":"7.4.0"}.

    What We Have Already Tried:
    • Confirmed the curl command syntax is correct for modern Zabbix, with the auth token at the top level of the JSON body.
    • Verified the API endpoint URL (http://10.88.16.80:8080/api_jsonrpc.php) is consistent for all calls.
    • Forced a full recreation of all containers using docker-compose down and docker-compose up --force-recreate --build.
    • Pruned the web container's Docker volumes (web-data-ssl, web-data-certs) to eliminate any possibility of stale data from a previous installation.
    • Confirmed all Zabbix images in my docker-compose.yml use a consistent and correct version tag (ubuntu-7.4-latest).

    The server is simultaneously identifying as version 7.4.0 while rejecting the version 7.4.0 authentication method. Thanks in advance for any help to get this resolved
  • Markku
    Senior Member
    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
    • Sep 2018
    • 1781

    #2
    What do you mean "auth token at the top level of the JSON body"?

    https://www.zabbix.com/documentation...ization-header says you need to use Authorization header.

    (edit: got it, 7.0 documentation says "Note that the auth property is deprecated. It will be removed in the future releases.")

    Markku
    Last edited by Markku; 24-07-2025, 10:58. Reason: Added note about "auth" field deprecation and removal

    Comment

    • praths
      Junior Member
      • Jul 2025
      • 5

      #3
      Thanks Markuu for your reply and sorry for the ambiguity.

      Below is the request I tried to send to the api and for which I get the error. I created the api token inside Zabbix and use this in the auth. As I understand this, what is being faced out is to send an authentication request using username and password and get a temporary token.

      curl -X POST \
      -H 'Content-Type: application/json-rpc' \
      -d '{
      "jsonrpc": "2.0",
      "method": "item.get",
      "params": {
      "output": [
      "itemid",
      "name"
      ],
      "selectTags": "extend"
      },
      "auth": "<---- Zabbix API Token --⇒",
      "id": 1
      }' \
      http://<ServerName>:<Port>/zabbix/api_jsonrpc.php

      Comment

      • Markku
        Senior Member
        Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
        • Sep 2018
        • 1781

        #4
        Originally posted by Donkey
        Yeah, you're doing it wrong. It should be
        http:// : /zabbix/api_jsonrpc.php?Authorization=Bearer <--GUID-->>
        Documentation (linked above) does not say that, is that kind of syntax really working (= sending HTTP call header as an URI parameter)?

        Markku

        Comment

        • Markku
          Senior Member
          Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
          • Sep 2018
          • 1781

          #5
          Yeah so praths please see the documentation (linked above) to set the Authorization header in curl call, "auth" field is not working in 7.4.

          Markku

          Comment

          • Markku
            Senior Member
            Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
            • Sep 2018
            • 1781

            #6
            Originally posted by Donkey
            Works for me.
            Wow, surprising (unless you have the Authorization header set as well). That style is not recommended though as the URL parameters can be shown in various access logs and reveal the token.

            Markku

            Comment

            • praths
              Junior Member
              • Jul 2025
              • 5

              #7
              Thanks guys. it works with this syntax:

              curl -X POST \
              -H 'Content-Type: application/json-rpc' \
              -H 'Authorization: Bearer YOUR_API_TOKEN_HERE' \
              -d '{
              "jsonrpc": "2.0",
              "method": "item.get",
              "params": {
              "output": "extend" },
              "id": 1
              }' \
              http://YOUR_ZABBIX_URL/api_jsonrpc.php

              The syntax I used before came from Gemini.... The hilarious part was when I was "informing" gemini about the corrected syntax :-)

              Once again, thanks a lot.

              Comment

              Working...