ExportXMLWordPrintable

    • Sprint candidates
    • 3

      API leaves params in preprocessing when updating a step from the one with param to the one w/o a param.

       

      Steps to reproduce:

      1.  Create a host and item on this host with the following preprocessing settings:
      2. Take the ID of the created item (For example: Open the settings of the created item in UI and take the itemid from the "itemid" URL parameter.).
      3. Make the item.get API request with the given itemid:
      POST {{api_url}}
      Content-Type: application/json
      Authorization: Bearer {{super_admin_token}}
       
      {
          "jsonrpc": "2.0",
          "method": "item.get",
          "params": {
              "output": ["itemid"],
        "selectPreprocessing": ["type", "params", "error_handler", "error_handler_params"],
        "itemids": ["72008"]
          },
          "id": 1
      }

      and receive the similar response body:

      {
        "jsonrpc": "2.0",
        "result": [
          {
            "itemid": "72008",
            "preprocessing": [
              {
                "type": "12",
                "params": "$.in.bytes",
                "error_handler": "0",
                "error_handler_params": ""
              },
              {
                "type": "1",
                "params": "8",
                "error_handler": "0",
                "error_handler_params": ""
              },
              {
                "type": "10",
                "params": "",
                "error_handler": "0",
                "error_handler_params": ""
              }
            ]
          }
        ],
        "id": 1
      }
      1. Update item preprocessing steps by swaping the 2nd and 3rd preprocessing steps without passing the "params" field for "Change per second" step:
      POST {{api_url}}
      Content-Type: application/json
      Authorization: Bearer {{super_admin_token}}
       
      {
          "jsonrpc": "2.0",
          "method": "item.update",
          "params": [
         {
         "itemid": "72008",
         "preprocessing": [
          {
           "type": "12",
           "params": "$.in.bytes",
           "error_handler": "0",
           "error_handler_params": ""
          },
          {
           "type": "10",
           "error_handler": "0",
           "error_handler_params": ""
          },
          {
           "type": "1",
           "params": "8",
           "error_handler": "0",
           "error_handler_params": ""
          }
         ]
        }
          ],
          "id": 1
      }

      Result: The update was successfully done, but the "params" value still contain the value of the previous preprocessing type. It is possible to see when making the repeatable item.get request.

      Expected: The value of "params" field should be set to default during the item.update.

       

            Assignee:
            Gregory Chalenko
            Reporter:
            Aleksejs Abrosimovs
            Team C
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - Not Specified
                Not Specified
                Logged:
                Time Spent - 3h
                3h