Avoid using labels to fill object fields in API calls

Infos:

  • Used Zammad version: 6.1.0
  • Used Zammad installation type: (source, package, docker-compose, …) package
  • Operating system: Centos 7
  • Browser + version: Firefox 102.15.1esr

Expected behavior:

  • We need to fill a select or tree_select “object” field using API by using a unchangeable identifier (often called “slugs”) for values instead of the display labels (since ours are often renamed and this breaks the API on client side).

Actual behavior:

  • To identify the “object” field in API calls one must use the “name” (and not the “Display label”), which is fine, but when filling its value from a fixed list (such as tree_select or select) one can only use the “Display label” corresponding to a given value. If/when this value is changed to find a better wording the API does not work anymore

Steps to reproduce the behavior:

  • Define an object field of tree_select type, fill with values
  • Write an API POST to create a ticket using one of the expected values, everything works
  • Change the labels of the values (because you want a better wording)
  • Call again the API, it will not work anymore (causing a HTTP 422 Unprocessable entity, invalid value … for field …)
1 Like

Hi @ldo. Could you please post some API calls which could be used for reproducing?

This topic was automatically closed 360 days after the last reply. New replies are no longer allowed.